def METHOD_NAME(
    self, x: "torch.Tensor", y: Optional["torch.Tensor"] = None
) -> Tuple["torch.Tensor", Optional["torch.Tensor"]]:
    """
    Apply Mixup data augmentation to feature data `x` and labels `y`.
    :param x: Feature data to augment with shape `(batch_size, ...)`.
    :param y: Labels of `x` either one-hot or multi-hot encoded of shape `(nb_samples, nb_classes)`
              or class indices of shape `(nb_samples,)`.
    :return: Data augmented sample. The returned labels will be probability vectors of shape
             `(nb_samples, nb_classes)`.
    :raises `ValueError`: If no labels are provided.
    """
    import torch  # lgtm [py/repeated-import]
    if y is None:
        raise ValueError("Labels `y` cannot be None.")
    # convert labels to one-hot encoding
    if len(y.shape) == 2:
        y_one_hot = y
    elif len(y.shape) == 1:
        y_one_hot = torch.nn.functional.one_hot(y, self.num_classes)
    else:
        raise ValueError(
            "Shape of labels not recognised. "
            "Please provide labels in shape (nb_samples,) or (nb_samples, nb_classes)"
        )
    n = x.shape[0]
    # sample the mixing factor from the Dirichlet distribution
    lmbs = np.random.dirichlet([self.alpha] * self.num_mix)
    x_aug = lmbs[0] * x
    y_aug = lmbs[0] * y_one_hot
    for lmb in lmbs[1:]:
        # randomly choose indices for samples to mix
        indices = torch.randperm(n, device=x.device)
        x_aug = x_aug + lmb * x[indices]
        y_aug = y_aug + lmb * y_one_hot[indices]
    return x_aug, y_aug