You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This code, when added in with the SimpleRNN example, fails.
s =SpiralClassifier(10, 20, 30)
ps, st = Lux.setup(Random.default_rng(), s)
x =rand(10, 20, 16)
gradient(ps) do ps
out, st =s(x, ps, st)
returnsum(out)
end
I couldn't find similar issues online but I believe the above code should work?
The issue seems not to stem from this specific example but is more general as I had the same problem with a custom layer.
When the state variable is ignored, there's no error.
gradient(ps) do ps
out, _ =s(x, ps, st)
returnsum(out)
end
gradient(ps) do ps
out, st = s(x, ps, st)
return sum(out)
end
This is semantically invalid. You are assigning to st without defining it in the local scope. It is always recommended to run the function without gradient and check that it works.
This code, when added in with the SimpleRNN example, fails.
I couldn't find similar issues online but I believe the above code should work?
The issue seems not to stem from this specific example but is more general as I had the same problem with a custom layer.
When the state variable is ignored, there's no error.
Stacktrace:
The text was updated successfully, but these errors were encountered: