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

Fix rrule_via_ad return type #86

Merged
merged 4 commits into from
Aug 28, 2022
Merged

Conversation

mcabbott
Copy link
Member

@mcabbott mcabbott commented Aug 18, 2022

This ought to return a tuple; what it returns now works in some contexts but not JuliaDiff/ChainRules.jl#644 .

julia> using Diffractor, ChainRulesCore

julia> ret = rrule_via_ad(Diffractor.DiffractorRuleConfig(), x -> log(exp(x)), 2)
Diffractor.OpticBundle{Float64}(2.0, (::Any)::Tuple{ZeroTangent, Any}->◌)

julia> y, bk = ret;  # ok

julia> Tuple(ret)
ERROR: MethodError: no method matching length(::Diffractor.OpticBundle{Float64})

Originally added in #45, thus my fault...

@JeffBezanson
Copy link
Contributor

That length method for OpticBundle should be added.

mcabbott and others added 2 commits August 18, 2022 17:10
Co-authored-by: Jeff Bezanson <jeff.bezanson@gmail.com>
@mcabbott
Copy link
Member Author

Is it ok to merge this?

src/stage1/generated.jl Outdated Show resolved Hide resolved
@mcabbott mcabbott merged commit 4fca843 into JuliaDiff:main Aug 28, 2022
@mcabbott mcabbott deleted the rrule_via_ad branch August 28, 2022 04:16
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

Successfully merging this pull request may close these issues.

2 participants