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","."]
code: def __iter__(self):
      num_samples = len(self)
      n = 0
      for clip in self.clip_sampler:
          if n < num_samples:
              yield clip
              n += 1
          else:
              break
  
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 MaxLengthClipSampler obj's underlying member method code with example usage: obj.__iter__() without return types