JuliaDiff / JuliaDiff/ReverseDiff.jl

MethodError: ReverseDiff.TrackedReal ... is ambiguous.

Open
#217 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
393
Forks
60
Avg merge
18h 24m
Merged PRs (30d)
8

Description

I got an error when I used Zygote over ReverseDiff for a neural ODE

  Test threw exception
  Expression: !(isnothing(Zygote.gradient(diff_loss, ps)))
  MethodError: ReverseDiff.TrackedReal{ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{false, SciMLBase.FullSpecialize, ICNF.var"#f_aug#48"{AbstractDifferentiation.ReverseDiffBackend, Planar{Float64, Array}, NamedTuple{(), Tuple{}}, Int64}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Float64}, Float64, 2}, ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{false, SciMLBase.FullSpecialize, ICNF.var"#f_aug#48"{AbstractDifferentiation.ReverseDiffBackend, Planar{Float64, Array}, NamedTuple{(), Tuple{}}, Int64}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Float64}, Float64, 2}, Nothing}(::ForwardDiff.Dual{ForwardDiff.Tag{ODEFunction{false, SciMLBase.FullSpecialize, ICNF.var"#f_aug#48"{AbstractDifferentiation.ReverseDiffBackend, Planar{Float64, Array}, NamedTuple{(), Tuple{}}, Int64}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Float64}, Float64, 2}) is ambiguous. Candidates:
    (T::Type{<:Real})(x::ForwardDiff.Dual) in Tracker at /home/runner/.julia/packages/Tracker/9xWLl/src/lib/real.jl:110
    ReverseDiff.TrackedReal{V, D, O}(value) where {V, D, O} in ReverseDiff at /home/runner/.julia/packages/ReverseDiff/YkVxM/src/tracked.jl:56
  Possible fix, define
    ReverseDiff.TrackedReal{V, D, O}(::ForwardDiff.Dual) where {V, D, O}

I don't know how to reproduce it with a simple code, If it can't be fixed without the original code; please close this issue.

Stacktrace:
https://github.com/impICNF/ICNF.jl/actions/runs/4099293121/jobs/7069064588#step:6:1680

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CI stack trace and inspect Tracker's lib/real.jl and ReverseDiff's tracked.jl around the competing constructors shown. Establish a minimal reproduction for the Zygote-over-ReverseDiff gradient expression; done means the ambiguity is resolved or a documented reason it cannot be fixed, with coverage for the case.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.