class_docstr: Ego4d video/audio/imu dataset for the moments benchmark:
  `<https://ego4d-data.org/docs/benchmarks/episodic-memory/>`
  
  This dataset handles the parsing of frames, loading and clip sampling for the
  videos.
  
  IO utilizing :code:`iopath.common.file_io.PathManager` to support
  non-local storage uri's.
code: def _transform_mm(
      self, sample_dict: Dict[str, Any]
  ) -> Optional[Dict[str, Any]]:
      log.info("_transform_mm")
      with profiler.record_function("_transform_mm"):
          video_uid = sample_dict["video_uid"]
          assert video_uid
  
          assert sample_dict["video"] is not None
          assert (
              "labels_id" in sample_dict
          ), f"Sample missing labels_id: {sample_dict}"
  
          video = sample_dict["video"]
  
          expected = int(self.VIDEO_FPS * self.window_sec)
          actual = video.size(1)
          if expected != actual:
              log.error(
                  f"video size mismatch: actual: {actual} expected: {expected} video: {video.size()} uid: {video_uid}",  # noqa
                  stack_info=True,
              )
              return None
  
          start = sample_dict["clip_start"]
          end = sample_dict["clip_end"]
          assert start >= 0 and end >= start
  
          if abs((end - start) - self.window_sec) > 0.01:
              log.warning(f"Invalid IMU time window: ({start}, {end})")
  
          if self.imu_data:
              sample_dict["imu"] = self.imu_data.get_imu_sample(
                  video_uid,
                  start,
                  end,
              )
              if self.check_IMU(sample_dict):
                  log.warning(f"Bad IMU sample: ignoring: {video_uid}")
                  return None
  
          sample_dict = self._video_transform()(sample_dict)
  
          if self.decode_audio:
              audio_fps = self.AUDIO_FPS
              sample_dict["audio"] = self._preproc_audio(
                  sample_dict["audio"], audio_fps
              )
              sample_dict["spectrogram"] = sample_dict["audio"][
                  "spectrogram"
              ]
  
          labels = sample_dict["labels"]
          one_hot = self.convert_one_hot(labels)
          sample_dict["labels_onehot"] = one_hot
  
          if self._transform_source:
              sample_dict = self._transform_source(sample_dict)
  
          log.info(
              f"Sample ({sample_dict['video_name']}): "
              f"({sample_dict['clip_start']:.2f}, {sample_dict['clip_end']:.2f}) "
              f" {sample_dict['labels_id']} | {sample_dict['labels']}"
          )
  
          return sample_dict
  
imports: import csv
  import json
  import logging
  import os
  from bisect import bisect_left
  from collections import defaultdict
  from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type
  import numpy
  import torch
  import torch.autograd.profiler
  import torch.utils.data
  import torchaudio
  from iopath.common.file_io import g_pathmgr
  from pytorchvideo.data import LabeledVideoDataset
  from pytorchvideo.data.clip_sampling import ClipSampler
  from pytorchvideo.data.ego4d.utils import Ego4dImuDataBase, get_label_id_map, MomentsClipSampler
  from pytorchvideo.data.utils import get_logger
  from pytorchvideo.data.video import VideoPathHandler
  from pytorchvideo.transforms import ApplyTransformToKey, Div255, Normalize, RandomShortSideScale, ShortSideScale
  from torchvision.transforms import CenterCrop, Compose, RandomCrop, RandomHorizontalFlip
label_desc: Use image node_id 3 for calling the Ego4dMomentsDataset obj's underlying member method code with example usage: obj._transform_mm(sample_dict) and returns: sample_dict, None, None