Skip to content

Commit

Permalink
Merge pull request #841 from SciML/avik-pal-patch-1
Browse files Browse the repository at this point in the history
fix: match iterations count in Sophia
  • Loading branch information
Vaibhavdixit02 authored Oct 7, 2024
2 parents 68f7a0b + b0f2a3f commit f6dd24d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sophia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function SciMLBase.__solve(cache::OptimizationCache{
gₜ = zero(θ)
mₜ = zero(θ)
hₜ = zero(θ)
for _ in 1:maxiters
for epoch in 1:maxiters
for (i, d) in enumerate(data)
if cache.f.fg !== nothing && dataiterate
x = cache.f.fg(gₜ, θ, d)
Expand All @@ -88,7 +88,7 @@ function SciMLBase.__solve(cache::OptimizationCache{
cache.f.grad(gₜ, θ)
x = cache.f(θ)
end
opt_state = Optimization.OptimizationState(; iter = i,
opt_state = Optimization.OptimizationState(; iter = i + (epoch - 1) * length(data),
u = θ,
objective = first(x),
grad = gₜ,
Expand Down

0 comments on commit f6dd24d

Please sign in to comment.