zero.stream.Stream.increment_epoch

Stream.increment_epoch(max=None)[source]

(Try to) increment epoch.

Parameters

max (Optional[Union[int, float]]) – if None or math.inf then epoch is incremented; otherwise, epoch is incremented only if self.epoch < max

Returns

True, if epoch was incremented, otherwise, False.

Raises

AssertionError – if max is float, but not math.inf

Return type

bool

Examples

stream = Stream(range(5))
assert stream.epoch == 0
assert stream.increment_epoch()
assert stream.epoch == 1
assert stream.increment_epoch(2)
assert stream.epoch == 2
assert not stream.increment_epoch(2)
assert stream.epoch == 2