Skip to content

Commit 3b8f66e

Browse files
Merge pull request #830 from SciML/Vaibhavdixit02-patch-1
Optimisers iteration count should be calculated with epochs and data both
2 parents c6e153f + d6a1e51 commit 3b8f66e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/OptimizationOptimisers/src/OptimizationOptimisers.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function SciMLBase.__solve(cache::OptimizationCache{
8080

8181
t0 = time()
8282
Optimization.@withprogress cache.progress name="Training" begin
83-
for _ in 1:maxiters
83+
for epoch in 1:maxiters
8484
for (i, d) in enumerate(data)
8585
if cache.f.fg !== nothing && dataiterate
8686
x = cache.f.fg(G, θ, d)
@@ -93,7 +93,7 @@ function SciMLBase.__solve(cache::OptimizationCache{
9393
cache.f.grad(G, θ)
9494
x = cache.f(θ)
9595
end
96-
opt_state = Optimization.OptimizationState(iter = i,
96+
opt_state = Optimization.OptimizationState(iter = i + (epoch-1)*length(data),
9797
u = θ,
9898
objective = x[1],
9999
grad = G,

0 commit comments

Comments
 (0)