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 _mix_batch(self, x):
      lam, use_cutmix = self._params_per_batch()
      if lam == 1.0:
          return 1.0
      if use_cutmix:
          (yl, yh, xl, xh), lam = cutmix_bbox_and_lam(
              x.shape,
              lam,
              ratio_minmax=self.cutmix_minmax,
              correct_lam=self.correct_lam,
          )
          x[:, :, yl:yh, xl:xh] = x.flip(0)[:, :, yl:yh, xl:xh]
      else:
          x_flipped = x.flip(0).mul_(1.0 - lam)
          x.mul_(lam).add_(x_flipped)
      return lam
  
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 6 for calling the MixupTransform obj's underlying member method code with example usage: obj._mix_batch(x) and returns: lam, int