SequentialTransform

class torchaug.transforms.SequentialTransform(transforms, **transforms_attributes_override)[source]

Sequentially apply a list of transforms.

Note

By default this SequentialTransform makes all its transforms to be inplace, batched inplace, and batched transform with unlimited chunks. If you want to change this behavior, you can override the default parameters by passing them as arguments. For example, if you want to make the transforms non-inplace, you can do the following:

>>> transforms = SequentialTransform(
>>>     [
>>>         Normalize([0.5], [0.5]),
>>>         RandomColorJitter(),
>>>     ],
>>>     inplace=False,
>>>     batch_inplace=False,
>>> )

Passing batch_transform=False will make the transforms non-batched and not inplace.

Parameters:
  • transforms (List[RandomApplyTransform]) – A list of transforms.

  • transforms_attributes_override (Dict[str, Any]) –

    Additional parameters to override the default parameters of the transforms if they exist. Useful to make transforms for batches. The list of parameters that can be overridden are:

    • inplace: whether the transform is inplace or not.

    • batch_inplace: whether the transform is inplace for batches or not.

    • batch_transform: whether the transform is batched or not.

    • num_chunks: number of chunks to split the input tensor.

    • permute_chunks: whether to permute the chunks or not.

extra_repr()[source]

Set the extra representation of the transform.

Return type:

str

forward(*inputs)[source]

Performs forward pass of the transform.

Parameters:

inputs (Any) – Inputs to the transform.

Return type:

Any

Returns:

Transformed inputs.