-
Notifications
You must be signed in to change notification settings - Fork 63
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
rrules for getindex seems to be ignored with Zygote #239
Comments
This only happens with struct Foo <: AbstractArray{Int,0} end When using struct Foo end Zygote does not call |
Also, using using Zygote, ZygoteRules
struct Foo <: AbstractArray{Int,0} end
Base.getindex(x::Foo) = throw(ErrorException("This should not be called"))
ZygoteRules.@adjoint Base.getindex(x::Foo) = 99, _ -> (42,)
Zygote.gradient(Base.getindex, Foo()) works as expected. |
Given how lightweight ChainRulesCore is, I guess it's must be a Zygote issue - I'll move it over there. Sorry! |
Moved to FluxML/Zygote.jl#811 . |
This is more of a feature than a bug. With the way that Zygote is currently implemented, any applicable This is exactly what's happening here -- |
Thanks, @willtebbutt! |
With
running
yields
(42,)
, as expected.myfunc
is bypassed and never called. However, the same withBase.getindex
throws
so Zygote seems to ignore that
rrule
and callBase.getindex
.I'm reporting this here, though I'm not sure if it's a problem in ChainRulesCore or Zygote (or maybe I'm doing something wrong here?).
The text was updated successfully, but these errors were encountered: