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

Complex gradients #169

Open
GeoffNN opened this issue Feb 3, 2022 · 4 comments
Open

Complex gradients #169

GeoffNN opened this issue Feb 3, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@GeoffNN
Copy link
Contributor

GeoffNN commented Feb 3, 2022

Opening this as a nota bene. When optimizing over complex parameters, the gradient must be conjugated. Currently, all jaxopt optimizers would be incorrect on complex parameters, due to this.

Moreover, if any optimizer relies on a second order moments (eg Adam), it must also use the complex module squared instead of just the parameter squared. Current jaxopt solvers might be affected as well. I'm unsure of what implcit diff would do to complex parameters, but perhaps we could output a warning that it is currently probably incorrect.

I realized this while using Optax on a model with complex weights; thought it might be good to incorporate this in jaxopt solvers as well, as users might 1) not be aware of this and 2) it's really hard to debug on the user side.

@GeoffNN
Copy link
Contributor Author

GeoffNN commented Feb 3, 2022

For instance, tree_l2_norm would currently give incorrect results on complex parameters.

squared_tree = tree_map(jnp.square, tree_x)

@mblondel
Copy link
Collaborator

mblondel commented Feb 5, 2022

+1 on fixing this, thanks for catching

@mblondel mblondel added the bug Something isn't working label Feb 27, 2022
@mblondel
Copy link
Collaborator

I think this is an issue we should tackle soon because as you said this could fail silently. Do you want to tackle it?

@GeoffNN
Copy link
Contributor Author

GeoffNN commented Sep 12, 2022

Hey! Sorry, I was interning this summer and off of github. I'll start checking this out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants