EnzymeAD / EnzymeAD/Enzyme.jl

1.10 reverse-mode correctness error

Open
#2,987 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
586
Forks
108
Avg merge
1d 5h
Merged PRs (30d)
44

Description

Forward-mode is correct, and 1.11 onwards is correct. Enzyme@0.13.129

```julia
import Enzyme

function wlj(x::Real, lower::Bool, upper::Real)
lbounded, ubounded = lower, isfinite(upper)
return if lbounded && ubounded
(log(x/upper) / one(x)), 0.0
elseif lbounded
log(x), 0.0
elseif ubounded
log(x), 0.0
else
x, 0.0
end
end

struct Foo
upper::Float64
end
function (f::Foo)(rx::AbstractArray)
return [first(wlj(rx[], true, f.upper))]
end

x = [0.5]
f = Foo(1.0)
Enzyme.jacobian(Enzyme.Reverse, f, x) # [0.0;;]

import ForwardDiff
@show ForwardDiff.jacobian(f, x) # [2.0;;]
```

## versioninfo

```julia
julia> versioninfo()
Julia Version 1.10.10
Commit 95f30e51f41 (2025-06-27 09:51 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
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.