-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
_project error #1078
Comments
To be clear, I have no problem whatsoever will projecting things (e.g. dropping the imaginary bit of a complex number representing the tangent of a real number) -- it's both a correctness and performance issue (especially where linear algebra is concerned). I just don't think the implementation is correct here 🤷 . I would be interested to know where you think projections could get in the way of optimisations because my experience has consistently been that failing to project is the thing that causes problems, but this probably isn't the place for that discussion. |
Should this be a CRC issue? You will get the same error regardless of what rule or function applies the projection. The assumption of projection is that it may be applied widely. It's likely to Or are you arguing that |
I was hoping you would suggest the appropriate fix :) Sounds like you're in favour of modification to CRC? Happy to open a PR if that's so. |
Possibly Zygote should type-pirate: (::ProjectTo)(dx::Tangent}) = dx to work-around the fact that it loses track of primal types (::ProjectTo{T})(dx::Tangent{<:T}) where {T} = dx This is what it currently does for Complex numbers for this reason, because it can't hit the Zygote.jl/src/compiler/chainrules.jl Line 151 in 528e0be
|
Seems reasonable to me. I'll open a PR. |
The problem occurs when one tries to take the
Zygote.gradient
of a function anAbstractArray
with a structural tangent.ProjectTo(my_array)
produces aProjectTo{AbstractArray}
, and Zygote winds up producing aTangent{Any}
for it. This means that this method doesn't apply.MWE:
What is the appropriate fix @mcabbott @oxinabox @mzgubic ? I can work around this by using
pullback
or_pullback
directly, but it's obviously sub-optimal not to be able to usegradient
.Where's the discussion about adding the
_project
call here? I feel like I've seen it somewhere, but I'm not sure where...The text was updated successfully, but these errors were encountered: