Why Optim.seconds(res) does not exist?

Almost all is in the title… With Optim.jl, wouldn’t it be useful to have a function that can access the number of seconds run for an optimization problem? If this exists already, i did not find it.

I think you want time_run.

julia> f(x) = (sum(x)-1)^2
f (generic function with 1 method)

julia> sol = optimize(f, rand(100), GradientDescent())
 * Status: success

[...]


julia> Optim.time_run(sol)
2.7894973754882812e-5

It’s not exported though and thus needs to be accessed with Optim.time_run or imported explicitly.

2 Likes