rocAL_pybind.amd.rocal.plugin.generic.ROCALClassificationIterator Class Reference

rocAL_pybind.amd.rocal.plugin.generic.ROCALClassificationIterator Class Reference#

rocAL: rocAL_pybind.amd.rocal.plugin.generic.ROCALClassificationIterator Class Reference
rocAL_pybind.amd.rocal.plugin.generic.ROCALClassificationIterator Class Reference

ROCAL iterator for classification tasks for generic use case. More...

Inheritance diagram for rocAL_pybind.amd.rocal.plugin.generic.ROCALClassificationIterator:
rocAL_pybind.amd.rocal.plugin.generic.ROCALGenericIterator

Public Member Functions

def __init__ (self, pipelines, size=0, auto_reset=False, fill_last_batch=True, dynamic_shape=False, last_batch_padded=False, display=False, device="cpu", device_id=0)
 
- Public Member Functions inherited from rocAL_pybind.amd.rocal.plugin.generic.ROCALGenericIterator
def next (self)
 
def __next__ (self)
 
def reset (self)
 
def __iter__ (self)
 
def __len__ (self)
 
def __del__ (self)
 

Additional Inherited Members

- Data Fields inherited from rocAL_pybind.amd.rocal.plugin.generic.ROCALGenericIterator
 loader
 
 tensor_format
 
 multiplier
 
 offset
 
 device
 
 device_id
 
 reverse_channels
 
 tensor_dtype
 
 display
 
 batch_size
 
 labels_size
 
 output_list
 
 dimensions
 
 dtype
 
 labels_tensor
 
 iterator_length
 
 eos
 
 index
 
 num_batches
 
 output_tensor_list
 
 output
 
 labels
 

Detailed Description

ROCAL iterator for classification tasks for generic use case.

It returns 2 outputs (data and label) in the form of numpy/cupy Tensor.

Calling

.. code-block:: python

ROCALClassificationIterator(pipelines, size)

is equivalent to calling

.. code-block:: python

ROCALGenericIterator(pipelines, ["data", "label"], size)

Please keep in mind that Tensors returned by the iterator are still owned by ROCAL. They are valid till the next iterator call. If the content needs to be preserved please copy it to another tensor.

Parameters
pipelines(listof amd.rocal.pipeline.Pipeline) List of pipelines to use
size(int) Number of samples in the epoch (Usually the size of the dataset).
auto_reset(bool, optional, default = False) Whether the iterator resets itself for the next epoch or it requires reset() to be called separately.
fill_last_batch(bool, optional, default = True Whether to fill the last batch with data up to 'self.batch_size'. The iterator would return the first integer multiple of self._num_gpus * self.batch_size entries which exceeds 'size'. Setting this flag to False will cause the iterator to return exactly 'size' entries.
dynamic_shape(bool, optional, default = False) Whether the shape of the output of the ROCAL pipeline can change during execution. If True, the numpy tensor will be resized accordingly if the shape of ROCAL returned tensors changes during execution. If False, the iterator will fail in case of change.
last_batch_padded(bool, optional, default = False) Whether the last batch provided by ROCAL is padded with the last sample or it just wraps up. In the conjunction with fill_last_batch it tells if the iterator returning last batch with data only partially filled with data from the current epoch is dropping padding samples or samples from the next epoch. If set to False next epoch will end sooner as data from it was consumed but dropped. If set to True next epoch would be the same length as the first one.
display(bool, optional, default = False) Whether the images should be saved as png files for display.
device(str, optional, default = "cpu") Whether to use CPU or GPU backend for the dataloader.
device_id(int, optional, default = 0) Device ID of the GPU being used for the training loader.

Example

With the data set [1,2,3,4,5,6,7] and the batch size 2: fill_last_batch = False, last_batch_padded = True -> last batch = [7], next iteration will return [1, 2] fill_last_batch = False, last_batch_padded = False -> last batch = [7], next iteration will return [2, 3] fill_last_batch = True, last_batch_padded = True -> last batch = [7, 7], next iteration will return [1, 2] fill_last_batch = True, last_batch_padded = False -> last batch = [7, 1], next iteration will return [2, 3]


The documentation for this class was generated from the following file:
  • /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocal/checkouts/docs-6.1.1/rocAL_pybind/amd/rocal/plugin/generic.py