zero.stream.Stream.increment_epoch¶
-
Stream.
increment_epoch
(max=None)[source]¶ (Try to) increment epoch.
- Parameters
max (Optional[Union[int, float]]) – if
None
ormath.inf
then epoch is incremented; otherwise, epoch is incremented only ifself.epoch < max
- Returns
True, if epoch was incremented, otherwise, False.
- Raises
AssertionError – if max is float, but not
math.inf
- Return type
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