Skip to content

Pullback of exponent fails, j not defined in Zygote #1573

Closed
JuliaDiff/ChainRules.jl
#820
@jClugstor

Description

@jClugstor
julia> g(p) = exponent(p)
g (generic function with 1 method)

julia> _,back = Zygote._pullback(g, 4.0)
(2, (g))

julia> back(4.0)
ERROR: UndefVarError: `j` not defined in `Zygote`
Suggestion: check for spelling errors or missing imports.
Stacktrace:
  [1] macro expansion
    @ ~/.julia/packages/Zygote/wfLOG/src/compiler/interface2.jl:0 [inlined]
  [2] (::Zygote.Pullback{Tuple{Core.IntrinsicFunction, UInt64, UInt64}, Tuple{Core.IntrinsicFunction}})(Δ::Float64)
    @ Zygote ~/.julia/packages/Zygote/wfLOG/src/compiler/interface2.jl:100
  [3] <<
    @ ./int.jl:529 [inlined]
  [4] (::Zygote.Pullback{Tuple{typeof(<<), UInt64, UInt64}, Tuple{Zygote.Pullback{Tuple{}, Tuple{}}}})(Δ::Float64)
    @ Zygote ~/.julia/packages/Zygote/wfLOG/src/compiler/interface2.jl:0
  [5] >>
    @ ./int.jl:534 [inlined]
  [6] (::Zygote.Pullback{Tuple{…}, Tuple{…}})(Δ::Float64)
    @ Zygote ~/.julia/packages/Zygote/wfLOG/src/compiler/interface2.jl:0
  [7] exponent
    @ ./math.jl:950 [inlined]
  [8] (::Zygote.Pullback{Tuple{typeof(exponent), Float64}, Any})(Δ::Float64)
    @ Zygote ~/.julia/packages/Zygote/wfLOG/src/compiler/interface2.jl:0
  [9] g
    @ ./REPL[13]:1 [inlined]
 [10] (::Zygote.Pullback{Tuple{typeof(g), Float64}, Tuple{Zygote.Pullback{Tuple{typeof(exponent), Float64}, Any}}})(Δ::Float64)
    @ Zygote ~/.julia/packages/Zygote/wfLOG/src/compiler/interface2.jl:0
 [11] top-level scope
    @ REPL[15]:1
Some type information was truncated. Use `show(err)` to see complete types.
(jl_BfWUbu) pkg> st
Status `/tmp/jl_BfWUbu/Project.toml`
  [e88e6eb3] Zygote v0.7.7
julia> versioninfo()
Julia Version 1.11.3
Commit d63adeda50d (2025-01-21 19:42 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 × AMD Ryzen 7 6800U with Radeon Graphics
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver3)
Threads: 1 default, 0 interactive, 1 GC (on 16 virtual cores)

Metadata

Metadata

Assignees

No one assigned

    Labels

    ChainRulesadjoint -> rrule, and further integrationbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions