ray.data.Dataset.iterator#

Dataset.iterator() ray.data.dataset_iterator.DatasetIterator[source]#

Return a DatasetIterator that can be used to repeatedly iterate over the dataset.

Examples

>>> import ray
>>> for batch in ray.data.range(
...     1000000
... ).iterator().iter_batches(): 
...     print(batch) 

Note

It is recommended to use DatasetIterator methods over directly calling methods such as iter_batches().