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

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

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

rocAL iterator for classification tasks for PyTorch. More...

Inheritance diagram for rocAL_pybind.amd.rocal.plugin.pytorch.ROCALClassificationIterator:
rocAL_pybind.amd.rocal.plugin.pytorch.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.pytorch.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.pytorch.ROCALGenericIterator
 loader
 
 tensor_format
 
 multiplier
 
 offset
 
 reverse_channels
 
 tensor_dtype
 
 device
 
 device_id
 
 batch_size
 
 labels_size
 
 output_list
 
 output_memory_type
 
 iterator_length
 
 display
 
 eos
 
 index
 
 num_batches
 
 output_tensor_list
 
 labels_tensor
 
 bbox_list
 
 labels_list
 
 labels
 
 bboxes
 
 img_size
 
 label_2d_numpy
 
 bb_2d_numpy
 
 bb_padded
 
 labels_padded
 

Detailed Description

rocAL iterator for classification tasks for PyTorch.

It returns 2 outputs (data and label) in the form of PyTorch's Tensors.

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.

pipelines (list of 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 pytorch 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.

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/pytorch.py