CallbackPrintTiming

class odl.solvers.util.callback.CallbackPrintTiming(fmt='Time elapsed = {:<5.03f} s', step=1, cumulative=False, **kwargs)[source]

Bases: Callback

Callback for printing the time elapsed since the previous iteration.

Methods

__call__(_)

Print time elapsed from the previous iteration.

reset()

Set time to the current time.

__init__(fmt='Time elapsed = {:<5.03f} s', step=1, cumulative=False, **kwargs)[source]

Initialize a new instance.

Parameters:
fmtstring, optional

Formating that should be applied. The time is printed as

print(fmt.format(runtime))

where runtime is the runtime since the last iterate.

steppositive int, optional

Number of iterations between prints.

cumulativeboolean, optional

Print the time since the initialization instead of the last call.

Other Parameters:
kwargs

Key word arguments passed to the print function.