class_docstr: Reader for TFRecords using the MediaSequence format.
  
  Attributes:
    num_classes: int. The number of classes in the dataset.
    base_dir: str. The base directory from which the TFRecords are read.
    subset: str. The subset of the dataset. In Scenic, the subsets are
      "train", "validation" and "test".
class_docstr_tok: ["Reader","for","TFRecords","using","the","MediaSequence","format",".","Attributes",":","num_classes",":","int",".","The","number","of","classes","in","the","dataset",".","base_dir",":","str",".","The","base","directory","from","which","the","TFRecords","are","read",".","subset",":","str",".","The","subset","of","the","dataset",".","In","Scenic",",","the","subsets","are","``","train","''",",","``","validation","''","and","``","test","''","."]
docstr: Adds DMVR pre-processors to the dataset.
  
  Args:
    is_training: whether or not in training mode.
    num_frames: number of frames per subclip.
    stride: temporal stride to sample frames.
    num_test_clips: number of test clip (1 by default). If more than one,
      this will sample multiple linearly spaced clips within each video at
      test time. If 1, then a single clip in the middle of the video is
      sampled.
    min_resize: frames are resized so that min width/height is min_resize.
    crop_size: final size of the frame after cropping the resized frames.
    zero_centering_image: whether to have image values in the interval [-1, 1]
      or [0, 1].
    train_frame_sampling_mode: Method of sampling frames during training.
      Options are one of {random, random_sample_with_centre, centre}
    one_hot_label: whether or not to return one hot version of labels.
    get_label_str: whether or not to return label as text.
    label_offset: If non-zero, this value is subtracted from the parsed label.
      Useful when dataset is 1-indexed.
docstr_tok: ["Adds","DMVR","pre-processors","to","the","dataset",".","Args",":","is_training",":","whether","or","not","in","training","mode",".","num_frames",":","number","of","frames","per","subclip",".","stride",":","temporal","stride","to","sample","frames",".","num_test_clips",":","number","of","test","clip","(","1","by","default",")",".","If","more","than","one",",","this","will","sample","multiple","linearly","spaced","clips","within","each","video","at","test","time",".","If","1",",","then","a","single","clip","in","the","middle","of","the","video","is","sampled",".","min_resize",":","frames","are","resized","so","that","min","width\/height","is","min_resize",".","crop_size",":","final","size","of","the","frame","after","cropping","the","resized","frames",".","zero_centering_image",":","whether","to","have","image","values","in","the","interval","[","-1",",","1","]","or","[","0",",","1","]",".","train_frame_sampling_mode",":","Method","of","sampling","frames","during","training",".","Options","are","one","of","{","random",",","random_sample_with_centre",",","centre","}","one_hot_label",":","whether","or","not","to","return","one","hot","version","of","labels",".","get_label_str",":","whether","or","not","to","return","label","as","text",".","label_offset",":","If","non-zero",",","this","value","is","subtracted","from","the","parsed","label",".","Useful","when","dataset","is","1-indexed","."]
code: def _build(
      self,
      is_training: bool = True,
      # Video related parameters.
      num_frames: int = 32,
      stride: int = 1,
      num_test_clips: int = 1,
      min_resize: int = 256,
      crop_size: int = 224,
      zero_centering_image: bool = False,
      train_frame_sampling_mode: str = "random",
      # Label related parameters.
      one_hot_label: bool = True,
      get_label_str: bool = False,
      label_offset: int = 0,
  ):
      """Adds DMVR pre-processors to the dataset.
  
      Args:
        is_training: whether or not in training mode.
        num_frames: number of frames per subclip.
        stride: temporal stride to sample frames.
        num_test_clips: number of test clip (1 by default). If more than one,
          this will sample multiple linearly spaced clips within each video at
          test time. If 1, then a single clip in the middle of the video is
          sampled.
        min_resize: frames are resized so that min width/height is min_resize.
        crop_size: final size of the frame after cropping the resized frames.
        zero_centering_image: whether to have image values in the interval [-1, 1]
          or [0, 1].
        train_frame_sampling_mode: Method of sampling frames during training.
          Options are one of {random, random_sample_with_centre, centre}
        one_hot_label: whether or not to return one hot version of labels.
        get_label_str: whether or not to return label as text.
        label_offset: If non-zero, this value is subtracted from the parsed label.
          Useful when dataset is 1-indexed.
      """
      modalities.add_image(
          parser_builder=self.parser_builder,
          sampler_builder=self.sampler_builder,
          decoder_builder=self.decoder_builder,
          preprocessor_builder=self.preprocessor_builder,
          postprocessor_builder=self.postprocessor_builder,
          is_training=is_training,
          num_frames=num_frames,
          stride=stride,
          num_test_clips=num_test_clips,
          min_resize=min_resize,
          crop_size=crop_size,
          zero_centering_image=zero_centering_image,
      )
  
      modalities.add_label(
          parser_builder=self.parser_builder,
          decoder_builder=self.decoder_builder,
          preprocessor_builder=self.preprocessor_builder,
          one_hot_label=one_hot_label,
          num_classes=self.num_classes,
          add_label_name=get_label_str,
      )
  
      if label_offset:
          self.preprocessor_builder.add_fn(
              fn=lambda x: x - label_offset,
              feature_name=builders.LABEL_INDEX_FEATURE_NAME,
              fn_name=f"label_offset_{label_offset}",
              add_before_fn_name=(
                  f"{builders.LABEL_INDEX_FEATURE_NAME}_one_hot"
              ),
          )
  
imports: import functools
  import os
  from typing import Dict, Iterator, List, Optional, Text, Tuple, Union
  from absl import logging
  from dmvr import builders
  from dmvr import modalities
  from dmvr import video_dataset
  from flax import jax_utils
  import jax
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.dataset_lib import dataset_utils
  from scenic.dataset_lib import datasets
  from scenic.dataset_lib import video_ops
  from scenic.projects.vivit.data import file_utils
  import tensorflow
label_desc: Use image node_id 2 for calling the TFRecordDatasetFactory obj's underlying member method code with example usage: obj._build(is_training, num_frames, stride, num_test_clips, min_resize, crop_size, zero_centering_image, train_frame_sampling_mode, one_hot_label, get_label_str, label_offset) without return types