Skip to content
Snippets Groups Projects
Commit 31bebf0d authored by Bas Nijholt's avatar Bas Nijholt
Browse files

implement own version of 'round' that speeds up the Learner1D by 30%

parent 669cf077
No related branches found
No related tags found
No related merge requests found
Pipeline #13929 passed
......@@ -692,5 +692,7 @@ def finite_loss(ival, loss, x_scale):
# We round the loss to 12 digits such that losses
# are equal up to numerical precision will be considered
# equal.
return round(loss, ndigits=12), ival
# equal. This is 3.5x faster than unsing the `round` function.
round_fac = 1e12
loss = int(loss * round_fac + 0.5) / round_fac
return loss, ival
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment