You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am on Julia 1.10.3 and Enzyme main (5fc2309). The following works:
struct A1{T}
x::Tendstruct B{T}
as::Tendfunctionf1(x, ::Val{AT}) where AT
as = [A1(x) for i in1:10]
as2 =AT(as)
b =B(as2)
return b.as[1].x
endautodiff(Reverse, f1, Active, Active(2.0), Const(Val(Array)))[1][1] # Gives 1.0
However, adding an unused field to the struct makes the gradient disappear:
struct A2{T}
index::Int
x::Tendfunctionf2(x, ::Val{AT}) where AT
as = [A2(i, x) for i in1:10]
as2 =AT(as)
b =B(as2)
return b.as[1].x
endautodiff(Reverse, f2, Active, Active(2.0), Const(Val(Array)))[1][1] # Gives 0.0, should be 1.0
The text was updated successfully, but these errors were encountered:
I am on Julia 1.10.3 and Enzyme main (5fc2309). The following works:
However, adding an unused field to the
struct
makes the gradient disappear:The text was updated successfully, but these errors were encountered: