Zygote.jl icon indicating copy to clipboard operation
Zygote.jl copied to clipboard

`one'(x)` errors, although `gradient(one, 0.0) === nothing` does not

Open cossio opened this issue 2 years ago • 1 comments

using Zygote
julia> one'(0.0)
ERROR: MethodError: no method matching getindex(::Nothing, ::Int64)
Stacktrace:
 [1] (::Zygote.var"#59#60"{typeof(one)})(x::Float64)
   @ Zygote ~/.julia/packages/Zygote/FPUm3/src/compiler/interface.jl:83
 [2] top-level scope
   @ REPL[5]:1

cossio avatar Jan 27 '22 16:01 cossio

This is only about the weird adjoint overload, gradient is fine:

julia> gradient(one, 0.0)

julia> one'(0.0)
ERROR: MethodError: no method matching getindex(::Nothing, ::Int64)

mcabbott avatar Jul 26 '22 19:07 mcabbott