extorch.utils.data

extorch.utils.data.mix_data(self, inputs: torch.Tensor, targets: torch.Tensor, alpha: float = 1.0)[source]

Mixup data for training neural networks on convex combinations of pairs of examples and their labels (Link).

Parameters
  • inputs (Tensor) – Input examples.

  • targets (Tensor) – Labels of input examples.

  • alpha (float) – Parameter of the beta distribution. Default: 1.0.

Returns

Input examples after mixup. mixed_targets (Tensor): Labels of mixed inputs. _lambda (float): Parameter sampled from the beta distribution.

Return type

mixed_inputs (Tensor)