Skip to content
New issue

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

PaddedViews does not support Zygote.gradient? #367

Closed
chooron opened this issue Jul 17, 2024 · 2 comments
Closed

PaddedViews does not support Zygote.gradient? #367

chooron opened this issue Jul 17, 2024 · 2 comments

Comments

@chooron
Copy link

chooron commented Jul 17, 2024

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

@dlfivefifty
Copy link
Member

Shouldn't this issue be in PaddedViews.jl?

@chooron
Copy link
Author

chooron commented Jul 17, 2024

Sure, please see #69

@chooron chooron closed this as completed Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants