zero.stream.ManualStream.data

ManualStream.data(*, n_iterations=None, n_msteps=None)[source]

Iterate over the loader.

Exactly one of the arguments must be given.

Parameters
Raises
Return type

Iterator

Examples

stream = ManualStream(range(5))
data = stream.data(n_msteps=1)
assert next(data) == 0
assert next(data) == 1
assert next(data) == 2
assert stream.iteration == 3
stream.increment_mstep()
try:
    next(data)
except StopIteration:
    print('StopIteration')
StopIteration