code: def permutate(self, perm, *args):
      ret = []
      batch_size = None
      num_ref = None
  
      for arg in args:  # (batch, num_inf, ...)
          if batch_size is None:
              batch_size, num_ref = arg.shape[:2]
          else:
              assert torch.Size([batch_size, num_ref]) == arg.shape[:2]
  
          ret.append(
              torch.stack(
                  [
                      arg[torch.arange(batch_size), perm[:, i]]
                      for i in range(num_ref)
                  ],
                  dim=1,
              )
          )
      return ret
  
imports: import itertools
  from collections import defaultdict
  from contextlib import contextmanager
  from typing import Callable, Dict, List, Optional, Tuple, Union
  import torch
  from packaging.version import parse
  from typeguard import check_argument_types
  from espnet2.asr.ctc import CTC
  from espnet2.asr.decoder.abs_decoder import AbsDecoder
  from espnet2.asr.encoder.abs_encoder import AbsEncoder
  from espnet2.asr.espnet_model import ESPnetASRModel
  from espnet2.asr.frontend.abs_frontend import AbsFrontend
  from espnet2.asr.postencoder.abs_postencoder import AbsPostEncoder
  from espnet2.asr.preencoder.abs_preencoder import AbsPreEncoder
  from espnet2.asr.specaug.abs_specaug import AbsSpecAug
  from espnet2.enh.loss.wrappers.abs_wrapper import AbsLossWrapper
  from espnet2.layers.abs_normalize import AbsNormalize
  from espnet2.torch_utils.device_funcs import force_gatherable
label_desc: Use image node_id 3 for calling the PITLossWrapper obj's underlying member method code with example usage: obj.permutate(perm) and returns: ret