code: def test_reading_from_directory_structure_hmdb51(self, decoder):
      # For an unknown reason this import has to be here for `buck test` to work.
      import torchvision.io as io
  
      with tempfile.TemporaryDirectory() as root_dir:
          # Create test directory structure with two classes and a video in each.
          root_dir_name = pathlib.Path(root_dir)
          action_1 = "running"
          action_2 = "cleaning_windows"
  
          videos_root_dir = root_dir_name / "videos"
          videos_root_dir.mkdir()
  
          test_class_1 = videos_root_dir / action_1
          test_class_1.mkdir()
          data_1 = create_dummy_video_frames(15, 10, 10)
          test_class_2 = videos_root_dir / action_2
          test_class_2.mkdir()
          data_2 = create_dummy_video_frames(20, 15, 15)
  
          test_splits = root_dir_name / "folds"
          test_splits.mkdir()
  
          with tempfile.NamedTemporaryFile(
              suffix="_u_nm_np1_ba_goo_19.avi", dir=test_class_1
          ) as f_1, tempfile.NamedTemporaryFile(
              suffix="_u_nm_np1_fr_med_1.avi", dir=test_class_2
          ) as f_2:
              f_1.close()
              f_2.close()
  
              # Write lossless video for each class.
              io.write_video(
                  f_1.name,
                  data_1,
                  fps=30,
                  video_codec="libx264rgb",
                  options={"crf": "0"},
              )
              io.write_video(
                  f_2.name,
                  data_2,
                  fps=30,
                  video_codec="libx264rgb",
                  options={"crf": "0"},
              )
  
              _, video_name_1 = os.path.split(f_1.name)
              _, video_name_2 = os.path.split(f_2.name)
  
              with open(
                  os.path.join(
                      test_splits, action_1 + "_test_split1.txt"
                  ),
                  "w",
              ) as f:
                  f.write(f"{video_name_1} 1\n")
  
              with open(
                  os.path.join(
                      test_splits, action_2 + "_test_split1.txt"
                  ),
                  "w",
              ) as f:
                  f.write(f"{video_name_2} 1\n")
  
              clip_sampler = make_clip_sampler("uniform", 3)
              dataset = Hmdb51(
                  data_path=test_splits,
                  video_path_prefix=root_dir_name / "videos",
                  clip_sampler=clip_sampler,
                  video_sampler=SequentialSampler,
                  split_id=1,
                  split_type="train",
                  decode_audio=False,
                  decoder=decoder,
              )
  
              # Videos are sorted alphabetically so "cleaning windows" (i.e. data_2)
              # will be first.
              sample_1 = next(dataset)
              sample_2 = next(dataset)
  
              self.assertTrue(sample_1["label"] in [action_1, action_2])
              if sample_1["label"] == action_2:
                  sample_1, sample_2 = sample_2, sample_1
  
              self.assertEqual(sample_1["label"], action_1)
              self.assertEqual(5, len(sample_1["meta_tags"]))
              self.assertTrue(
                  sample_1["video"].equal(
                      thwc_to_cthw(data_1).to(torch.float32)
                  )
              )
  
              self.assertEqual(sample_2["label"], action_2)
              self.assertEqual(5, len(sample_2["meta_tags"]))
              self.assertTrue(
                  sample_2["video"].equal(
                      thwc_to_cthw(data_2).to(torch.float32)
                  )
              )
  
imports: import collections
  import contextlib
  import itertools
  import math
  import multiprocessing
  import os
  import pathlib
  import tempfile
  import unittest
  import unittest.mock
  from fractions import Fraction
  from typing import List, Tuple
  from unittest.mock import Mock, patch
  import av
  import torch
  import torch.distributed
  from parameterized import parameterized
  from pytorchvideo.data import Hmdb51
  from pytorchvideo.data.clip_sampling import make_clip_sampler
  from pytorchvideo.data.labeled_video_dataset import labeled_video_dataset, LabeledVideoDataset
  from pytorchvideo.data.labeled_video_paths import LabeledVideoPaths
  from pytorchvideo.data.utils import MultiProcessSampler, thwc_to_cthw
  from torch.multiprocessing import Process
  from torch.utils.data import DataLoader, DistributedSampler, RandomSampler, SequentialSampler, TensorDataset
  from utils import create_dummy_video_frames, temp_encoded_video, temp_frame_video_dataset
label_desc: Use image node_id 6 for calling the TestLabeledVideoDataset obj's underlying member method code with example usage: obj.test_reading_from_directory_structure_hmdb51(decoder) without return types