class_docstr: MaxLengthClipSampler is a thin wrapper on top of clip samplers in TorchVision.
  
  It takes as input a TorchVision clip sampler, and an optional argument
  `num_samples` to limit the number of samples.
class_docstr_tok: ["MaxLengthClipSampler","is","a","thin","wrapper","on","top","of","clip","samplers","in","TorchVision",".","It","takes","as","input","a","TorchVision","clip","sampler",",","and","an","optional","argument","`","num_samples","`","to","limit","the","number","of","samples","."]
docstr: The constructor method of MaxLengthClipSampler.
  
  Args:
      clip_sampler: clip sampler without a limit on the total number of clips
          it can sample, such as RandomClipSampler and UniformClipSampler.
      num_samples: if provided, it denotes the maximal number of clips the sampler
          will return
docstr_tok: ["The","constructor","method","of","MaxLengthClipSampler",".","Args",":","clip_sampler",":","clip","sampler","without","a","limit","on","the","total","number","of","clips","it","can","sample",",","such","as","RandomClipSampler","and","UniformClipSampler",".","num_samples",":","if","provided",",","it","denotes","the","maximal","number","of","clips","the","sampler","will","return"]
code: def __init__(self, clip_sampler, num_samples=None):
      """The constructor method of MaxLengthClipSampler.
  
      Args:
          clip_sampler: clip sampler without a limit on the total number of clips
              it can sample, such as RandomClipSampler and UniformClipSampler.
          num_samples: if provided, it denotes the maximal number of clips the sampler
              will return
  
      """
      self.clip_sampler = clip_sampler
      self.num_samples = num_samples
  
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 1 to create a new MaxLengthClipSampler object from inherited base classes: Sampler with example: obj = MaxLengthClipSampler(clip_sampler, num_samples)