LastCheckpointKeeper

class LastCheckpointKeeper(keep: int = 1)[source]

Bases: CheckpointKeeper

Keep the last \(n\) checkpoints.

Attributes Summary

keep

the number of checkpoints to keep

Methods Summary

__call__(steps)

Iterate over the steps for which checkpoints should be kept.

Attributes Documentation

Parameters:

keep (int)

keep: int = 1

the number of checkpoints to keep

Methods Documentation

__call__(steps: Sequence[int]) Iterator[int][source]

Iterate over the steps for which checkpoints should be kept.

Parameters:

steps (Sequence[int]) – the sorted list of steps at which checkpoints were written.

Yields:

the steps for which checkpoints should be kept

Return type:

Iterator[int]