Enzyme.jl
Enzyme.jl copied to clipboard
Add split mode
using Enzyme
julia> f(x) = x^2
f (generic function with 1 method)
julia> ((tape, res), backward) = Enzyme.forward_back(f, Active, Active(2.0))
((Ptr{Nothing} @0x0000000003da4c80, 4.0), Enzyme.Compiler.AdjointThunk{typeof(f), Active{Float64}, Tuple{Active{Float64}}, Nothing}(f, Ptr{Nothing} @0x00007fc41b835060, nothing))
julia> backward(Active(2.0), 1.0, tape)
(4.0,)
~@wsmoses I don't understand why I have to pass Active(1.0)
to the backwards pass. I expected it to be Active(2.0)
~
You should be passing Active(2.0)
d/dx x^2 = 2x = 4 (evaluated at 2)
Superceeded by https://github.com/EnzymeAD/Enzyme.jl/pull/664