-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
No adjoint for Base.Iterators.ProductIterator #421
Comments
Is there any workaround for this? I think differentiation of such constructs is definitely necessary, especially for matrix construction as array mutation is not supported. |
You could borrow it from here: https://github.com/FluxML/Zygote.jl/pull/785/files#diff-a9e025ac90a30d27e7512546971c5d92ea7c3496ba759336ae6bf1cace6db4b2R240 |
Thanks, but this does not seem to work with custom types for Consider the following example based on the documentation:
This yields the following error:
|
What's the objection to Without those definitions, the default is to use a NamedTuple, and these also don't have |
You're right. I tried the |
Bump. Hitting this issue right now. Is there a workaround? julia> using Zygote, Flux
julia> X = randn(5); Y = randn(5);
julia> ps = Flux.params(X,Y);
julia> gs = gradient(ps) do
sum([sin(x*y) for x in X, y in Y])
end
Update: Replacing the comprehension by a broadcast works: gs = gradient(ps) do
sum(sin.(X*Y'))
end Maybe a general solution can be derived from this. |
This worked very well for me for a |
Bump, just ran into this, too. |
If anyone wants to help fix up #785, or pull this part out as a smaller PR, that would be great. |
Ran into it recently too, so I'll try to get a working patch out with smaller changes. |
It's not possible to differentiate through a matrix constructed from a multidimensional array comprehension, which returns a
ProductIterator
type with no adjoint. MWE:Originally posted by @mcabbott in #377 (comment)
The text was updated successfully, but these errors were encountered: