mindspore.dataset.Dataset.create_tuple_iterator

Dataset.create_tuple_iterator(columns=None, num_epochs=- 1, output_numpy=False, do_copy=True)[source]

Create an iterator over the dataset. The datatype retrieved back will be a list of numpy.ndarray .

To specify which columns to list and the order needed, use columns_list. If columns_list is not provided, the order of the columns will remain unchanged.

Parameters
  • columns (list[str], optional) – List of columns to be used to specify the order of columns. Default: None, means all columns.

  • num_epochs (int, optional) – Maximum number of epochs that iterator can be iterated. Default: -1, iterator can be iterated infinite number of epochs.

  • output_numpy (bool, optional) – Whether or not to output NumPy datatype. If output_numpy=False, iterator will output MSTensor. Default: False.

  • do_copy (bool, optional) – when output data type is mindspore.Tensor, use this param to select the conversion method, only take False for better performance. Default: True.

Returns

Iterator, tuple iterator over the dataset.

Examples

>>> # dataset is an instance object of Dataset
>>> iterator = dataset.create_tuple_iterator()
>>> for item in iterator:
...     # item is a list
...     print(type(item))
...     break
<class 'list'>