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
Whereas it works normally in the REPL
The text was updated successfully, but these errors were encountered:
Thanks for reporting this! It turns out, Pluto adds some magic to the call so it's traced differently from a normal REPL. In REPL:
julia> Yota.Umlaut.trace(x -> sum(x .+ 1), [1.0, 2.0, 3.0]) (9.0, Tape{BaseCtx} inp %1::var"#101#102" inp %2::Vector{Float64} %3 = broadcasted(+, %2, 1)::Broadcasted{} %4 = materialize(%3)::Vector{Float64} %5 = sum(%4)::Float64 )
In Pluto:
(9.0, Tape{Umlaut.BaseCtx} inp %1::var"#3#4"{typeof(+), typeof(sum)} inp %2::Vector{Float64} %3 = getfield(%1, :sum)::typeof(sum) # <--- %4 = getfield(%1, :+)::typeof(+) # <--- %5 = broadcasted(%4, %2, 1)::Broadcasted{} %6 = materialize(%5)::Vector{Float64} %7 = %3(%6)::Float64)
One workaround is to define the missing rrule:
rrule
using ChainRulesCore ChainRulesCore.rrule(getfield, x, f::Symbol) = (getfield(x, f), dy -> (NoTangent(), NoTangent(), NoTangent()))
After this the example gives the correct result:
grad(x -> sum(x .+ 1), [1.0, 2.0, 3.0]) # ==> (9.0, (NoTangent(), [1.0, 1.0, 1.0]))
Sorry, something went wrong.
No branches or pull requests
Whereas it works normally in the REPL
The text was updated successfully, but these errors were encountered: