Skip to content

Commit da12a24

Browse files
committed
define maxiters similar to epochs
1 parent f6a7301 commit da12a24

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/OptimizationOptimisers/src/OptimizationOptimisers.jl

+11-1
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,19 @@ function SciMLBase.__solve(cache::OptimizationCache{
5959
else
6060
cache.solver_args.epochs
6161
end
62+
maxiters = if cache.solver_args.maxiters === nothing
63+
if cache.solver_args.epochs === nothing
64+
throw(ArgumentError("The number of iterations must be specified with either the epochs or maxiters kwarg. Where maxiters = epochs*length(data)."))
65+
else
66+
cache.solver_args.epochs * length(data)
67+
end
68+
else
69+
cache.solver_args.maxiters
70+
end
6271

6372
epochs = Optimization._check_and_convert_maxiters(epochs)
64-
if epochs === nothing
73+
maxiters = Optimization._check_and_convert_maxiters(maxiters)
74+
if epochs === nothing || maxiters === nothing
6575
throw(ArgumentError("The number of iterations must be specified with either the epochs or maxiters kwarg. Where maxiters = epochs*length(data)."))
6676
end
6777

0 commit comments

Comments
 (0)