code: def mixup_target(target, num_classes, lam=1.0, smoothing=0.0):
      if target.ndim == 1:
          off_value = smoothing / num_classes
          on_value = 1.0 - smoothing + off_value
          y1 = one_hot(
              target,
              num_classes,
              on_value=on_value,
              off_value=off_value,
              device=target.device,
          )
          y2 = one_hot(
              target.flip(0),
              num_classes,
              on_value=on_value,
              off_value=off_value,
              device=target.device,
          )
      else:
          # when 2D one-hot/multi-hot target tensor is already provided, skip label
          # smoothing
          assert (
              target.ndim == 2
          ), "target tensor shape must be 1D or 2D"
          y1 = target
          y2 = target.flip(0)
  
      return y1 * lam + y2 * (1.0 - 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 2 for calling a global function with example usage: mixup_target(target, num_classes, lam, smoothing) and returns: unknown