Skip to content
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

Interaction of Complex{Dual} with rrule for ^ on Julia ≤ 1.5 #525

Closed
mcabbott opened this issue Sep 7, 2021 · 4 comments
Closed

Interaction of Complex{Dual} with rrule for ^ on Julia ≤ 1.5 #525

mcabbott opened this issue Sep 7, 2021 · 4 comments

Comments

@mcabbott
Copy link
Member

mcabbott commented Sep 7, 2021

In Julia 1.5 and earlier, complex dual numbers did not work well. This leads to the following interaction between the log(complex(x))) in the rrule for ^, and Zygote's forward-over-reverse Hessian calculation:

julia> hessian(x -> x[1]^x[2], [3,4])
ERROR: StackOverflowError:
Stacktrace:
 [1] Complex at ./complex.jl:12 [inlined] (repeats 2 times)
 [2] float at ./complex.jl:1016 [inlined]
 [3] log(::Complex{ForwardDiff.Dual{Nothing,Float64,2}}) at ./complex.jl:583 (repeats 79984 times)

It did not happen prior to #513 (v1.11.4) because this rule had a different special case for real x and real p, which I think got some of the edge cases wrong. Perhaps we could do both. But I'm not sure how much work is justified in fixing this. Found in CI & avoided here.

@oxinabox
Copy link
Member

oxinabox commented Sep 8, 2021

maybe we could check if Julia is VERSION < v"1.6" and then do the bad thing that might get some edge cases wrong, just so we can avoid making Zygote's CI for 1.3 and 1.5 fail.

@mcabbott
Copy link
Member Author

mcabbott commented Sep 8, 2021

Zygote's CI will skip that test as soon as FluxML/Zygote.jl#1044 is merged.

@oxinabox
Copy link
Member

For my reference this is fixed in 1.6 by JuliaLang/julia#36030

@mcabbott
Copy link
Member Author

Closing since the package only supports 1.6 now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants