Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Efficient Kronecker Gradients in Zygote #11

Open
jessebett opened this issue Jul 23, 2019 · 4 comments
Open

Efficient Kronecker Gradients in Zygote #11

jessebett opened this issue Jul 23, 2019 · 4 comments

Comments

@jessebett
Copy link

Can you review the implementation of the gradients for kron in Zygote and Tracker? I directly ported these from Tensorflow.

Specifically could you comment on the implementation, and whether it could benefit from your package?

@MichielStock
Copy link
Owner

I will look at it Friday during the hackathon!

@MichielStock
Copy link
Owner

Can we discuss irl somewhere this week? Have some questions.

Btw, kron from Zygote seems to work a bit faster than base.

@jessebett
Copy link
Author

Yes. I'm around tomorrow and will also be at the hackathon on Friday working on Zygote stuff. The kron in Zygote is just some reshape rules. I did not benchmark against base, but that's pretty surprising, I wonder why.

@samanklesaria
Copy link

The reshape/broadcasting implementation doesn't use any of the nice structure from the module. What about the following:

vec(A) = reshape(A, :)

Zygote.@adjoint kronecker(A, B) = kronecker(A,B), dy-> (
  dy.A .* (vec(dy.B)' * vec(B)), dy.B .* (vec(A)' * vec(dy.A)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants