-
-
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
getindex for real input fails with complex sensitivity #376
Comments
There's no great reason to use |
You mean to implement for arrays in Julia base or to have our own |
Ideally, it would be in base, but that will take too long; it'd be fine to have something in Zygote and switch out to Base if it ever gets added. |
Okay, I guess a simple Zygote-friendly
This would certainly resolve the bug raised here, but I wonder if this introduces new issues. e.g., if |
That looks like that right direction. To avoid the double-copy you could just loop over |
This seems to have been fixed sometime: julia> using Zygote
julia> x = randn(2)
2-element Array{Float64,1}:
-1.4516208598004956
-0.3941745254755234
julia> y, back = Zygote._pullback(x->x[1]*im, x)
(-0.0 - 1.4516208598004956im, ∂(#10))
julia> back(1.0)
(nothing, Complex{Float64}[0.0 - 1.0im, 0.0 + 0.0im]) |
getindex
's adjoint assumes the sensitivity is of the same type as the input. This causesInexactError
s when the input togetindex
is real but the sensitivity is complex.The culprit appears to be these lines:
Zygote.jl/src/lib/array.jl
Lines 31 to 32 in def6b45
The text was updated successfully, but these errors were encountered: