We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
I am beginner in Julia and I would like to use Flux. I tried to do the following:
using Flux NN = Chain(Dense(1, 5, σ), Dense(5, 1, σ))
using Flux
NN = Chain(Dense(1, 5, σ), Dense(5, 1, σ))
model(x) = NN([x])[1]; df(x) = gradient(model, x)[1]
model(x) = NN([x])[1];
df(x) = gradient(model, x)[1]
function lossEq(x) (df(x) - 2.0 * x - 3)^2 end
function lossEq(x)
(df(x) - 2.0 * x - 3)^2
end
gs = gradient(() -> lossEq(0.2), params(NN))
But the following error is raised:
ERROR: Can't differentiate foreigncall expression
Is it actually possible to compute such a gradient that involves a gradient ?
Best,
Lucas
The text was updated successfully, but these errors were encountered:
You should be able to see this. You could also check out https://github.com/DhairyaLGandhi/Zygote.jl/tree/dg/iddict to see if that works out better
Sorry, something went wrong.
Also, when taking nested gradients, it might be better to call y, back = Zygote.pullback(...) and then back(...) explicitly.
y, back = Zygote.pullback(...)
back(...)
No branches or pull requests
Hi,
I am beginner in Julia and I would like to use Flux. I tried to do the following:
using Flux
NN = Chain(Dense(1, 5, σ), Dense(5, 1, σ))
model(x) = NN([x])[1];
df(x) = gradient(model, x)[1]
function lossEq(x)
(df(x) - 2.0 * x - 3)^2
end
gs = gradient(() -> lossEq(0.2), params(NN))
But the following error is raised:
ERROR: Can't differentiate foreigncall expression
Is it actually possible to compute such a gradient that involves a gradient ?
Best,
Lucas
The text was updated successfully, but these errors were encountered: