-
Notifications
You must be signed in to change notification settings - Fork 112
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
Need an adjoint for constructor for Zygote compatibility #737
Comments
NAThompson
changed the title
Need an adjoint for constructor
Need an adjoint for constructor for Zygote compatibility
Aug 18, 2024
For those finding this issue, I have managed to figure out how to get this working: Simply add Zygote.@adjoint function Quantity(x::Number, u)
return Quantity(x, u), (∂y -> (∂y * Quantity(1.0, u), nothing))
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to use Zygote with Unitful. If I use standard units like m, s and m/s, everything works:
However, if I use a custom unit (in this case Euros) I get an error about requiring an adjoint for the constructor:
Apologies if my google-fu has failed me, but I have searched the Unitful docs, but did not manage to find anything about defining an adjoint for a constructor. How can I define one?
Code to reproduce:
The text was updated successfully, but these errors were encountered: