Skip to content

broken nested forward diff on julia v1.12 #1594

@CarloLucibello

Description

@CarloLucibello

There are a few broken tests involving nested forward derivatives

using Zygote
using Zygote.Forward: pushforward
D(f, x) = pushforward(f, x)(1)
D(x -> D(cos, x), 0.5)
ERROR: non-differentiable function getglobal
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:44
  [2] macro expansion
    @ ~/.julia/packages/IRTools/v0mn8/src/reflection/dynamo.jl:-1 [inlined]
  [3] _pushforward(::Tuple{Nothing, Nothing, Nothing}, ::typeof(getglobal), ::Module, ::Symbol)
    @ Zygote.Forward ~/.julia/packages/IRTools/v0mn8/src/reflection/dynamo.jl:177
  [4] _pushforward(::Tuple{Nothing, Nothing, Nothing}, ::typeof(ZygoteRules.literal_getproperty), ::Module, ::Val{:cos})
    @ Zygote.Forward ~/.julia/packages/IRTools/v0mn8/src/reflection/dynamo.jl:177
  [5] _pushforward(::Tuple{…}, ::typeof(Zygote.Forward._pushforward), ::Tuple{…}, ::typeof(cos), ::Float64)
    @ Zygote.Forward ~/.julia/packages/IRTools/v0mn8/src/reflection/dynamo.jl:177
  [6] _apply(::Function, ::Vararg{Any})
    @ Core ./boot.jl:1019
  [7] _pushforward
    @ ~/.julia/dev/Zygote/src/forward/lib.jl:60 [inlined]
  [8] _pushforward
    @ ~/.julia/dev/Zygote/src/forward/lib.jl:63 [inlined]
  [9] #pushforward##0
    @ ~/.julia/dev/Zygote/src/forward/interface.jl:49 [inlined]
 [10] _pushforward(::Tuple{…}, ::Zygote.Forward.var"#pushforward##0#pushforward##1"{…}, ::Int64)
    @ Zygote.Forward ~/.julia/packages/IRTools/v0mn8/src/reflection/dynamo.jl:0
 [11] (::Zygote.Forward.var"#pushforward##0#pushforward##1"{var"#274#275", Tuple{Float64}})(ẋ::Int64)
    @ Zygote.Forward ~/.julia/dev/Zygote/src/forward/interface.jl:49
 [12] D(f::Function, x::Float64)
    @ Main ./REPL[7]:1
 [13] top-level scope
    @ REPL[8]:1
Some type information was truncated. Use `show(err)` to see complete types.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions