ray.data.Dataset.iterator
ray.data.Dataset.iterator#
- Dataset.iterator() ray.data.iterator.DataIterator [source]#
Return a
DataIterator
that can be used to repeatedly iterate over the dataset.Note
Calling any of the consumption methods on the returned
DataIterator
will trigger execution of the lazy transformations performed on this dataset.Examples
>>> import ray >>> for batch in ray.data.range( ... 1000000 ... ).iterator().iter_batches(): ... print(batch)
Note
It is recommended to use
DataIterator
methods over directly calling methods such asiter_batches()
.