class_docstr: This implements the mixup data augmentation in the paper
  "mixup: Beyond Empirical Risk Minimization" (https://arxiv.org/abs/1710.09412)
class_docstr_tok: ["This","implements","the","mixup","data","augmentation","in","the","paper","''","mixup",":","Beyond","Empirical","Risk","Minimization","''","(","https",":","\/\/arxiv.org\/abs\/1710.09412",")"]
docstr: Args:
      mixup_alpha: the hyperparameter of Beta distribution used to sample mixup
      coefficient.
      num_classes: number of classes in the dataset.
      cutmix_alpha: cutmix alpha value, cutmix is active if > 0.
      cutmix_minmax cutmix min/max image ratio, cutmix is active and uses this vs alpha if not None.
      mix_prob: probability of applying mixup or cutmix per batch or element
      switch_prob: probability of switching to cutmix instead of mixup when both are active
      mode: how to apply mixup/cutmix params (per 'batch', 'pair' (pair of elements), 'elem' (element)
      correct_lam: apply lambda correction when cutmix bbox clipped by image borders.
      label_smoothing: apply label smoothing to the mixed target tensor
docstr_tok: ["Args",":","mixup_alpha",":","the","hyperparameter","of","Beta","distribution","used","to","sample","mixup","coefficient",".","num_classes",":","number","of","classes","in","the","dataset",".","cutmix_alpha",":","cutmix","alpha","value",",","cutmix","is","active","if",">","0.","cutmix_minmax","cutmix","min\/max","image","ratio",",","cutmix","is","active","and","uses","this","vs","alpha","if","not","None",".","mix_prob",":","probability","of","applying","mixup","or","cutmix","per","batch","or","element","switch_prob",":","probability","of","switching","to","cutmix","instead","of","mixup","when","both","are","active","mode",":","how","to","apply","mixup\/cutmix","params","(","per","'batch","'",",","'pair","'","(","pair","of","elements",")",",","'elem","'","(","element",")","correct_lam",":","apply","lambda","correction","when","cutmix","bbox","clipped","by","image","borders",".","label_smoothing",":","apply","label","smoothing","to","the","mixed","target","tensor"]
code: def __init__(
      self,
      mixup_alpha: float,
      num_classes: Optional[int] = None,
      cutmix_alpha: float = 0,
      cutmix_minmax: Optional[Tuple[float]] = None,
      mix_prob: float = 1.0,
      switch_prob: float = 0.5,
      mode: str = "batch",
      correct_lam: bool = True,
      label_smoothing: float = 0.0,
  ):
      """
      Args:
          mixup_alpha: the hyperparameter of Beta distribution used to sample mixup
          coefficient.
          num_classes: number of classes in the dataset.
          cutmix_alpha: cutmix alpha value, cutmix is active if > 0.
          cutmix_minmax cutmix min/max image ratio, cutmix is active and uses this vs alpha if not None.
          mix_prob: probability of applying mixup or cutmix per batch or element
          switch_prob: probability of switching to cutmix instead of mixup when both are active
          mode: how to apply mixup/cutmix params (per 'batch', 'pair' (pair of elements), 'elem' (element)
          correct_lam: apply lambda correction when cutmix bbox clipped by image borders.
          label_smoothing: apply label smoothing to the mixed target tensor
      """
      self.mixup_alpha = mixup_alpha
      self.num_classes = num_classes
      self.cutmix_alpha = cutmix_alpha
      self.cutmix_minmax = cutmix_minmax
      self.mix_prob = mix_prob
      self.switch_prob = switch_prob
      self.label_smoothing = label_smoothing
      self.mode = mode
      self.correct_lam = correct_lam
      self.label_smoothing = label_smoothing
  
imports: import collections.abc
  import math
  from typing import Any, Dict, Optional, Tuple
  import numpy
  import torch
  from torch.distributions.beta import Beta
label_desc: Use image node_id 1 to create a new MixupTransform object  with example: obj = MixupTransform(mixup_alpha, num_classes, cutmix_alpha, cutmix_minmax, mix_prob, switch_prob, mode, correct_lam, label_smoothing)