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

PaddedViews does not support Zygote.gradient?

Open chooron opened this issue 7 months ago • 0 comments

I have a matrix that I want to fill with 0 values ​​using PaddedViews.jl: f2 = x -> sum(PaddedView(eltype(x)(0.0), x, (5, 5))) But when using zygote to calculate the gradient:

arr = collect(reshape(1:9, 3, 3))
Zygote.gradient(f2, arr)

The following error occurs: ERROR: Need an adjoint for constructor PaddedView{Int64, 2, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}, Matrix{Int64}}. Gradient is of type FillArrays.Fill{Int64, 2, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}} This bug seems similar to #483

chooron avatar Jul 17 '24 06:07 chooron