Closed just-walk closed 2 months ago
Also I get a similar error with this input in 0.11.20 and 0.12. Enzyme doesn't like using a value from a range in a loop.
INPUT:
function summat(p::Real)
n = 2
A = Matrix{typeof(p)}(undef, n, n)
n_points = n^2
interval = 2 * π
z_range = range(start = -interval / 2, stop = interval / 2, length = n_points)
for (i, z) in enumerate(z_range)
A[i] = i + z
end
return sum(A)
end
@show autodiff(ReverseWithPrimal, summat, Active, Active(3.0))
@just-walk I think the issue here is the float range, not the enumerate. This is known to have issues by under the hood being implemented with TwicePrecision which is not supported atm.
Duplicate of https://github.com/EnzymeAD/Enzyme.jl/issues/274
The latest version of Enzyme can't handle the
enumerate
function. I tried testing the following function withenumerate
and with a simple range1:n_points
. In 0.11, both work, but in 0.12, I get the error below for a loop over a range output fromenumerate
.INPUT:
OUTPUT: