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",")"]
code: def _params_per_batch(self):
      lam = 1.0
      use_cutmix = False
      if torch.rand(1) < self.mix_prob:
          if self.mixup_alpha > 0.0 and self.cutmix_alpha > 0.0:
              use_cutmix = torch.rand(1) < self.switch_prob
              lam_mix = (
                  Beta(self.cutmix_alpha, self.cutmix_alpha).sample()
                  if use_cutmix
                  else Beta(self.mixup_alpha, self.mixup_alpha).sample()
              )
          elif self.mixup_alpha > 0.0:
              lam_mix = Beta(
                  self.mixup_alpha, self.mixup_alpha
              ).sample()
          elif self.cutmix_alpha > 0.0:
              use_cutmix = True
              lam_mix = Beta(
                  self.cutmix_alpha, self.cutmix_alpha
              ).sample()
          else:
              raise ValueError(
                  "One of mixup_alpha > 0., cutmix_alpha > 0., cutmix_minmax not None should be true."
              )
          lam = float(lam_mix)
  
      return lam, use_cutmix
  
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 3 for calling the MixupTransform obj's underlying member method code with example usage: obj._params_per_batch() and returns: lam,  use_cutmix