class_docstr: Mixup: Beyond Empirical Risk Minimization (https://arxiv.org/abs/1710.09412)
class_docstr_tok: ["Mixup",":","Beyond","Empirical","Risk","Minimization","(","https",":","\/\/arxiv.org\/abs\/1710.09412",")"]
docstr: The input is a batch of samples and their corresponding labels.
  
  Args:
      x (torch.Tensor): Input tensor. The input should be a batch of videos with
          shape (B, C, T, H, W).
      labels (torch.Tensor): Labels for input with shape (B).
      Optional: x_audio: Audio input tensor.
docstr_tok: ["The","input","is","a","batch","of","samples","and","their","corresponding","labels",".","Args",":","x","(","torch.Tensor",")",":","Input","tensor",".","The","input","should","be","a","batch","of","videos","with","shape","(","B",",","C",",","T",",","H",",","W",")",".","labels","(","torch.Tensor",")",":","Labels","for","input","with","shape","(","B",")",".","Optional",":","x_audio",":","Audio","input","tensor","."]
code: def forward(
      self,
      x_video: torch.Tensor,
      labels: torch.Tensor,
      **args: Any,
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      """
      The input is a batch of samples and their corresponding labels.
  
      Args:
          x (torch.Tensor): Input tensor. The input should be a batch of videos with
              shape (B, C, T, H, W).
          labels (torch.Tensor): Labels for input with shape (B).
          Optional: x_audio: Audio input tensor.
      """
      assert (
          x_video.size(0) > 1
      ), "MixUp cannot be applied to a single instance."
      mixup_lambda = self.mixup_beta_sampler.sample()
      x_video_flipped = x_video.flip(0).mul_(1.0 - mixup_lambda)
      x_video.mul_(mixup_lambda).add_(x_video_flipped)
  
      new_labels = _mix_labels(
          labels,
          self.num_classes,
          mixup_lambda,
          self.label_smoothing,
          one_hot=self.one_hot,
      )
  
      if args.get("x_audio", None) is not None:
          x_audio = args["x_audio"]
          assert (
              x_audio.size(0) > 1
          ), "MixUp cannot be applied to a single instance."
          x_audio_flipped = x_audio.flip(0).mul_(1.0 - mixup_lambda)
          x_audio.mul_(mixup_lambda).add_(x_audio_flipped)
          return x_video, x_audio, new_labels
      else:
          return x_video, new_labels
  
file_path: pytorchvideo/pytorchvideo/transforms/mix.py
imports: from typing import Any, Dict, Tuple
  import torch
  from pytorchvideo.transforms.functional import convert_to_one_hot
label_desc: Use image node_id 2 for calling the MixUp obj's underlying member method code with example usage: obj.forward(x_video, labels) and returns: x_video,  x_audio,  new_labels, x_video,  new_labels