code: def _recursive_mixup(
      sample: Any, permuted_indices: torch.Tensor, coeff: float
  ):
      if isinstance(sample, (tuple, list)):
          mixed_sample = []
          for s in sample:
              mixed_sample.append(
                  _recursive_mixup(s, permuted_indices, coeff)
              )
  
          return (
              mixed_sample
              if isinstance(sample, list)
              else tuple(mixed_sample)
          )
      elif isinstance(sample, abc.Mapping):
          mixed_sample = {}
          for key, val in sample.items():
              mixed_sample[key] = _recursive_mixup(
                  val, permuted_indices, coeff
              )
  
          return mixed_sample
      else:
          assert torch.is_tensor(
              sample
          ), "sample is expected to be a pytorch tensor"
          # Assume training data is at least 3D tensor (i.e. 1D data). We only
          # mixup content data tensor (e.g. video clip, audio spectrogram), and skip
          # other tensors, such as frame_idx and timestamp in video clip samples.
          if sample.ndim >= 3:
              sample = (
                  coeff * sample
                  + (1.0 - coeff) * sample[permuted_indices, :]
              )
  
          return sample
  
imports: import collections.abc
  from typing import Any, Dict, Optional
  import numpy
  import torch
  from classy_vision.generic.util import convert_to_one_hot
  from torch.distributions.beta import Beta
  from vissl.data.collators import register_collator
  from .moco_collator import moco_collator
  from .simclr_collator import simclr_collator
label_desc: Use image node_id 3 for calling a global function with example usage: _recursive_mixup(sample, permuted_indices, coeff) and returns: unknown, mixed_sample, sample