-
Notifications
You must be signed in to change notification settings - Fork 78
Closed
Description
MWE:
import Enzyme: Enzyme, Forward, Reverse, Const
nt = (a = 0.0,)
x = [0.5]
function f(x, nt)
nt2 = deepcopy(nt)
return nt2.a + x[1]
end
f(x, nt) # 0.5
Enzyme.gradient(Forward, f, x, Const(nt))
#=
ERROR: MethodError: no method matching deepcopy_rtact(::@NamedTuple{a::Float64}, ::@NamedTuple{a::Float64}, ::IdDict{Any, Any}, ::@NamedTuple{a::Float64})
The function `deepcopy_rtact` exists, but no method is defined for this combination of argument types.
=#
Enzyme.gradient(Reverse, f, x, Const(nt))
#=
ERROR: AssertionError: !(typeof(x) <: Active)
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/Enzyme/dM66n/src/compiler.jl:5491 [inlined]
[2] enzyme_call
@ ~/.julia/packages/Enzyme/dM66n/src/compiler.jl:5025 [inlined]
[3] AugmentedForwardThunk
@ ~/.julia/packages/Enzyme/dM66n/src/compiler.jl:4964 [inlined]
[4] runtime_generic_augfwd(activity::Type{…}, runtimeActivity::Val{…}, strongZero::Val{…}, width::Val{…}, ModifiedBetween::Val{…}, RT::Val{…}, f::typeof(deepcopy), df::Nothing, primal_1::@NamedTuple{…}, shadow_1_1::Base.RefValue{…})
@ Enzyme.Compiler ~/.julia/packages/Enzyme/dM66n/src/rules/jitrules.jl:422
=#
versioninfo and stuff
(ppl) pkg> st
Status `~/ppl/Project.toml`
[7da242da] Enzyme v0.13.48
julia> versioninfo()
Julia Version 1.11.5
Commit 760b2e5b739 (2025-04-14 06:53 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: macOS (arm64-apple-darwin24.0.0)
CPU: 10 × Apple M1 Pro
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
mhauru
Metadata
Metadata
Assignees
Labels
No labels