class_docstr: Functor class of common_collate_fn()
class_docstr_tok: ["Functor","class","of","common_collate_fn","(",")"]
code: def __call__(
      self, data: Collection[Tuple[str, Dict[str, np.ndarray]]]
  ) -> Tuple[List[str], Dict[str, torch.Tensor]]:
      assert "speech" in data[0][1]
      assert "text" in data[0][1]
      if self.pad:
          num_frames = max(
              [sample["speech"].shape[0] for uid, sample in data]
          )
      else:
          num_frames = min(
              [sample["speech"].shape[0] for uid, sample in data]
          )
  
      new_data = []
      for uid, sample in data:
          waveform, label = sample["speech"], sample["text"]
          assert waveform.ndim == 1
          length = waveform.size
          # The MFCC feature is 10ms per frame, while the HuBERT's transformer output
          # is 20ms per frame. Downsample the KMeans label if it's generated by MFCC
          # features.
          if self.label_downsampling > 1:
              label = label[:: self.label_downsampling]
          if self.crop_audio:
              waveform, label, length = _crop_audio_label(
                  waveform,
                  label,
                  length,
                  num_frames,
                  self.rand_crop,
                  self.window_size,
                  self.window_shift,
                  self.sample_rate,
              )
          new_data.append((uid, dict(speech=waveform, text=label)))
  
      return common_collate_fn(
          new_data,
          float_pad_value=self.float_pad_value,
          int_pad_value=self.int_pad_value,
          not_sequence=self.not_sequence,
      )
  
file_path: espnet/espnet2/train/collate_fn.py
imports: import math
  from typing import Collection, Dict, List, Tuple, Union
  import numpy
  import torch
  from typeguard import check_argument_types, check_return_type
  from espnet.nets.pytorch_backend.nets_utils import pad_list
label_desc: Use image node_id 3 for calling the HuBERTCollateFn obj's underlying member method code with example usage: obj.__call__(data) and returns: common_collate_fn