-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
Compatibility issues of Zygote with results obtained from ForwardDiff #1189
Comments
The problem is that This was added in #968, and should probably be removed, it's too much of a footgun. What you should probably try is the other order, ForwardDiff over Zygote. |
Thank you for your comment explaining the reasons for the failure @mcabbott. Can Sure I ll try out them in the other order to check if it works, but in my situation the ForwardDiff.gradient on ForwardDiff based An other thing that I am trying is to use ReverseDiff on the |
It would be great to also if there are fixes for the following error in the above MWE. I had this coming up in other places as well even when there was no gradient over
|
I don't think so, it's worse than that. If ReverseDiff-over-ForwardDiff does work, then how it works might have clues to making Zygote-over-ForwardDiff work.
500 is not crazy for ForwardDiff. Note that even when it does work well, the overload (which I think we should remove) turns Zygote-over-ForwardDiff (error) into Forward-over-Forward, so it won't help with algorithmic complexity concerns.
This is a longstanding problem, and I think you will find sketches of how to fix it in old issues. If someone tidied them up & made a PR that would be great. But someone has to own it. |
Thank you for the insights! I ll try to dig deeper with ReverseDiff over ForwardDiff The @Zygote.adjoint (T::Type{<:SArray})(x::Number...) = T(x...), y->(nothing, y...)
julia> zygrad(h,[0.1,0.2,0.3])
(nothing,)
julia> zygrad(h,SVector(0.1,0.2,0.3))
(nothing,)
|
Hi everyone! First of all, thank you so much for the Flux and Zygote packages, very useful and great usage experience :D.
I have the following incompatibility when Zygote.gradient is used on a result from ForwardDiff. Following are the failing MWEs:
Specifically, I am trying to take the Zygote gradient of the Laplacian of a function, which has been computed using ForwardDiff as follows,
Although not my intended usage
But the most surprising "error" or problem is the following, which was going to be my backup if I can't have a fix for the above. Now, I use Vector for both variables (
x
) - the internal AD part and parameters (a
) - the outer AD part.I would be very happy to know fixes or alternatives for the above two procedures, especially the first one. One brute force fix I have is to use ForwardDiff for the outer gradient as well but this is very slow, as expected, for reasonably high number of parameters. I am using ForwardDiffs inside as the
dim(x)
in my case is not going to be large.The text was updated successfully, but these errors were encountered: