-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
Zygote Readme example of Jacobian etc #735
Comments
I am pretty sure that Zygote is currently limited to scalar-valued functions only |
@AzamatB the following code works: using ForwardDiff, Zygote
g1(x)=cos(x[1])+sin(x[2])
g2(x)=x[1]^2 + x[2]^2
g3(x)=log(x[1]) + exp(x[2])
gg(x)= [g1(x);g2(x);g3(x)]
x=[1.;2.]
#
Zygote.gradient(g1,x)
Zygote.gradient(g2,x)
Zygote.gradient(g3,x)
Zygote.forward_jacobian(gg,x)[2]
Zygote.hessian(g1,x)
#
ForwardDiff.gradient(g1,x)
ForwardDiff.gradient(g2,x)
ForwardDiff.gradient(g3,x)
ForwardDiff.jacobian(gg,x)
ForwardDiff.hessian(g1,x) |
xref #98, there ought to be a function Not sure the readme is the place to show how to cobble one together, nor how to call ForwardDiff. |
|
That was a bit cryptic perhaps, but Line 22 in 6b44000
I agree that jacobians ought to be mentioned in the manual. But they are secondary to In fact Zygote now does forward mode too, since #503, but not yet in the manual. If |
The readme would benefit w/ examples of differentiating general f: Rn -> Rm
The text was updated successfully, but these errors were encountered: