class_docstr: Interface specifying what a ClassyVision video dataset is expected to provide.
  
  This dataset considers every video as a collection of video clips of fixed size,
  specified by ``frames_per_clip``, where the step in frames between each clip
  is given by ``step_between_clips``. It uses a clip sampler to sample
  a specified number of clips (``clips_per_video``) from each video.
  For training set, a random clip sampler is used to
  sample a small number of clips (e.g. 1) from each video
  For testing set, a uniform clip sampler is used to evenly sample a large
  number of clips (e.g. 10) from the video.
  
  To give an example, for 2 videos with 10 and 15 frames respectively,
  if ``frames_per_clip=5`` and ``step_between_clips=5``, the dataset size
  will be (2 + 3) = 5, where the first two elements will come from video 1,
  and the next three elements from video 2. Note that we drop clips which do
  not have exactly ``frames_per_clip`` elements, so not all frames in a video
  may be present.
class_docstr_tok: ["Interface","specifying","what","a","ClassyVision","video","dataset","is","expected","to","provide",".","This","dataset","considers","every","video","as","a","collection","of","video","clips","of","fixed","size",",","specified","by","``","frames_per_clip","``",",","where","the","step","in","frames","between","each","clip","is","given","by","``","step_between_clips","``",".","It","uses","a","clip","sampler","to","sample","a","specified","number","of","clips","(","``","clips_per_video","``",")","from","each","video",".","For","training","set",",","a","random","clip","sampler","is","used","to","sample","a","small","number","of","clips","(","e.g",".","1",")","from","each","video","For","testing","set",",","a","uniform","clip","sampler","is","used","to","evenly","sample","a","large","number","of","clips","(","e.g",".","10",")","from","the","video",".","To","give","an","example",",","for","2","videos","with","10","and","15","frames","respectively",",","if","``","frames_per_clip=5","``","and","``","step_between_clips=5","``",",","the","dataset","size","will","be","(","2","+","3",")","=","5",",","where","the","first","two","elements","will","come","from","video","1",",","and","the","next","three","elements","from","video","2",".","Note","that","we","drop","clips","which","do","not","have","exactly","``","frames_per_clip","``","elements",",","so","not","all","frames","in","a","video","may","be","present","."]
docstr: Parse config to prepare arguments needed by the class constructor.
docstr_tok: ["Parse","config","to","prepare","arguments","needed","by","the","class","constructor","."]
code: def parse_config(cls, config: Dict[str, Any]):
      """Parse config to prepare arguments needed by the class constructor."""
      assert "frames_per_clip" in config, "frames_per_clip must be set"
  
      video_width = config.get("video_width", 0)
      video_height = config.get("video_height", 0)
      video_min_dimension = config.get("video_min_dimension", 0)
      audio_samples = config.get("audio_samples", 0)
      step_between_clips = config.get("step_between_clips", 1)
      frame_rate = config.get("frame_rate", None)
      clips_per_video = config.get("clips_per_video", 1)
  
      (
          transform_config,
          batchsize_per_replica,
          shuffle,
          num_samples,
      ) = super().parse_config(config)
  
      if not config["split"] == "train":
          # At testing time, we do not crop frames but conduct a FCN-style evaluation.
          # Video spatial resolution can vary from video to video. So we test one
          # video at a time, and NO. of clips in a minibatch should be equal to
          # No. of clips sampled from a video
          if not batchsize_per_replica == clips_per_video:
              logging.warning(
                  f"For testing, batchsize per replica ({batchsize_per_replica})"
                  + f"should be equal to clips_per_video ({clips_per_video})"
              )
  
      return (
          transform_config,
          batchsize_per_replica,
          shuffle,
          num_samples,
          config["frames_per_clip"],
          video_width,
          video_height,
          video_min_dimension,
          audio_samples,
          step_between_clips,
          frame_rate,
          clips_per_video,
      )
  
imports: import logging
  import os
  from typing import Any, Callable, Dict, Optional
  import torch
  from classy_vision.generic.distributed_util import get_rank, get_world_size
  from torch.utils.data import Sampler
  from torchvision import get_video_backend
  from torchvision.datasets.samplers.clip_sampler import DistributedSampler, RandomClipSampler, UniformClipSampler
  from .classy_dataset import ClassyDataset
label_desc: Use image node_id 2 for calling the ClassyVideoDataset obj's underlying member method code with example usage: obj.parse_config(cls, config) and returns: transform_config,  batchsize_per_replica,  shuffle,  num_samples,  config,  video_width,  video_height,  video_min_dimension,  audio_samples,  step_between_clips,  frame_rate,  clips_per_video