FluxML / Zygote.jl

21st century AD
https://fluxml.ai/Zygote.jl/
Other
1.48k stars 213 forks source link

wrong adjoint for `:` #954

Open simeonschaub opened 3 years ago

simeonschaub commented 3 years ago

The gradient here should be one, not nothing:

julia> using Zygote

julia> Zygote.gradient(x -> (x:3)[1], 1.2)
(nothing,)

julia> 1.2:3
1.2:1.0:2.2

It looks like the adjoint for : does not take into account that each item of the range does continuously depend on the starting point of the range.

DhairyaLGandhi commented 3 years ago

Great catch, yeah we should patch this up.