RandomApplyTransform

class torchaug.transforms.RandomApplyTransform(p=0.5, batch_inplace=False, num_chunks=1, permute_chunks=False, batch_transform=False)[source]

Base class for all randomly applied transforms.

For more details, please see Transforms Tutorial.

Parameters:
  • p (float, optional) – The probability of applying the transform. Default: 0.5

  • batch_inplace (bool, optional) – whether to apply the batch transform in-place. Does not prevent functionals to make copy but can reduce time and memory consumption. Default: False

  • num_chunks (int, optional) – number of chunks to split the batched input into. Default: 1

  • permute_chunks (bool, optional) – whether to permute the chunks. Default: False

  • batch_transform (bool, optional) – whether to apply the transform in batch mode. Default: False

extra_repr(exclude_names=[])[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.

property num_chunks: int

Get the number of chunks to split the input into.

Some subclasses can have a specific logic to determine the number of chunks.