Wrapper#

class torchaug.transforms.Wrapper(transforms, inplace=False)[source]#

Wrap transforms to handle tensor data.

Note

Iterates through transforms and their submodules.

  • If inplace attribute is found, it is set to True, inplace is handled at the wrapper level.

Note

If a transform makes a copy, the resulting tensor will not share the same underlying storage even if inplace is set to True.

Parameters:
  • transforms (list[Module] | Module) – A list of transform modules.

  • inplace (bool, optional) – Whether to perform the transforms inplace. If a transform makes a copy, the resulting tensor will not share the same underlying storage.

    Default: False

forward(tensor)[source]#

Apply transforms on the tensor.

If inplace is True, clone the tensor.

Parameters:

tensor (Tensor) – The tensor to transform.

Return type:

Tensor

Returns:

The transformed tensor.