You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am pretty sure there is a generic rrule for constructors.
Pretty sure I even wrote it down somewhere.
It is something like
function rrule(::Type{T}, args...) where T
constructor_pullback(dx::Tangent{T}) = (NoTangent(), canonicalize(dx)...)
# Special case for Zygote, which loses the primal type but also is always in canonical form anyway.
constructor_pullback(dx::Tangent{Any}) = (NoTangent(), dx...)
return T(args...), constructor_pullback
end
OTOH we only want to hit this for the default constructor (what Zygote basically has as __new__ I think)
Adding this more generally might break like all kinds of random constructors that we should be leaving alone?
idk
The text was updated successfully, but these errors were encountered:
Like #154
I am pretty sure there is a generic rrule for constructors.
Pretty sure I even wrote it down somewhere.
It is something like
OTOH we only want to hit this for the default constructor (what Zygote basically has as
__new__
I think)Adding this more generally might break like all kinds of random constructors that we should be leaving alone?
idk
The text was updated successfully, but these errors were encountered: