-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.11 Optimization pass [with no differentiation] creates different results #1993
Comments
using Enzyme
using LinearAlgebra
function divdriver_herm(dest, src)
# Dual-index implementation
i = 1 - 1
@inbounds for a in src
@inbounds dest[i+=1] = a
end
return nothing
end
H = Hermitian(Matrix([4.0 1.0; 2.0 5.0]))
dest = Matrix{Float64}(undef, 2, 2)
Enzyme.autodiff(
ForwardWithPrimal,
divdriver_herm,
Const,
Const(dest),
Const(H),
)[1]
@show dest
dest = Matrix{Float64}(undef, 2, 2)
divdriver_herm(dest, H)
@show dest
# 4.0 4.0
# 4.0 2.0 |
using Enzyme
using LinearAlgebra
Enzyme.API.printall!(true)
function divdriver_herm(dest, src)
N = size(src)
dat = src.data
len = N[1]
i = 1
while true
j = 1
while true
ld = @inbounds if i <= j
dat[i, j]
else
dat[j, i]
end
@inbounds dest[(i-1) * 2 + j] = ld
if j == len
break
end
j += 1
end
if i == len
break
end
i += 1
end
return nothing
end
H = Hermitian(Matrix([4.0 1.0; 2.0 5.0]))
dest = Matrix{Float64}(undef, 2, 2)
Enzyme.autodiff(
ForwardWithPrimal,
divdriver_herm,
Const,
Const(dest),
Const(H),
)[1]
@show dest
dest = Matrix{Float64}(undef, 2, 2)
divdriver_herm(dest, H)
@show dest
# 4.0 4.0
# 4.0 2.0
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: