Skip to content

Commit

Permalink
Merge pull request #679 from SciML/Vaibhavdixit02-patch-4
Browse files Browse the repository at this point in the history
Update OptimizationZygoteExt.jl
  • Loading branch information
Vaibhavdixit02 authored Jan 11, 2024
2 parents f2001e9 + c7347d2 commit d6bea20
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ext/OptimizationZygoteExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function Optimization.instantiate_function(f, x, adtype::AutoZygote, p,
grad = function (res, θ, args...)
val = Zygote.gradient(x -> _f(x, args...), θ)[1]
if val === nothing
res .= 0
res .= zero(typeof(θ))
else
res .= val
end
Expand Down Expand Up @@ -90,7 +90,7 @@ function Optimization.instantiate_function(f, cache::Optimization.ReInitCache,
grad = function (res, θ, args...)
val = Zygote.gradient(x -> _f(x, args...), θ)[1]
if val === nothing
res .= 0
res .= zero(typeof(θ))
else
res .= val
end
Expand Down

0 comments on commit d6bea20

Please sign in to comment.