batch_mixup#

torchaug.batch_transforms.functional.batch_mixup(tensor_1, tensor_2, lam, inplace=False)[source]#

Mix two tensors with linear interpolation.

The shape of the tensors is expected to be [B, …] with … any number of dimensions. The tensors should be floats.

Parameters:
  • tensor_1 (Tensor) – First tensor.

  • tensor_2 (Tensor) – Second tensor.

  • lam (float | Tensor) – Mixing coefficient. If float, same coefficient is applied on whole batch. If tensor, its expecting shape is [B, 1] or [B] or [1].

  • inplace (bool, optional) – Whether to perform the operation inplace.

    Default: False

Return type:

Tensor

Returns:

The mixed tensor.