Skip to content

Commit c9156b2

Browse files
committed
Fix
1 parent aa2c2e4 commit c9156b2

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

  • DifferentiationInterface/ext/DifferentiationInterfaceEnzymeExt

DifferentiationInterface/ext/DifferentiationInterfaceEnzymeExt/utils.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,18 @@ function _translate_prepared!(dc, c_wrapped::DI.Cache, ::Val{B}) where {B}
175175
end
176176

177177
function _translate_prepared!(
178-
dc, c_wrapped::Union{DI.ConstantOrCache,DI.FunctionContext}, ::Val{B}
178+
_dc, c_wrapped::Union{DI.ConstantOrCache,DI.FunctionContext}, ::Val{B}
179179
) where {B}
180180
c = DI.unwrap(c_wrapped)
181181
if isnothing(dc)
182-
return Constant(c)
182+
return Const(c)
183183
else
184-
make_zero!(dc)
184+
# make_zero!(dc) # doesn't work because of immutable values
185185
if B == 1
186+
dc = make_zero(c)
186187
return Duplicated(c, dc)
187188
else
189+
dc = ntuple(_ -> make_zero(c), Val(B))
188190
return BatchDuplicated(c, dc)
189191
end
190192
end

0 commit comments

Comments
 (0)