class_docstr: Given a list of transforms with weights, OpSampler applies weighted sampling to
  select n transforms, which are then applied sequentially to the input.
class_docstr_tok: ["Given","a","list","of","transforms","with","weights",",","OpSampler","applies","weighted","sampling","to","select","n","transforms",",","which","are","then","applied","sequentially","to","the","input","."]
docstr: Args:
      transforms_list (List[Callable]): A list of tuples of all available transforms
          to sample from.
      transforms_prob (Optional[List[float]]): The probabilities associated with
          each transform in transforms_list. If not provided, the sampler assumes a
          uniform distribution over all transforms. They do not need to sum up to one
          but weights need to be positive.
      num_sample_op (int): Number of transforms to sample and apply to input.
      randomly_sample_depth (bool): If randomly_sample_depth is True, then uniformly
          sample the number of transforms to apply, between 1 and num_sample_op.
      replacement (bool): If replacement is True, transforms are drawn with replacement.
docstr_tok: ["Args",":","transforms_list","(","List","[","Callable","]",")",":","A","list","of","tuples","of","all","available","transforms","to","sample","from",".","transforms_prob","(","Optional","[","List","[","float","]","]",")",":","The","probabilities","associated","with","each","transform","in","transforms_list",".","If","not","provided",",","the","sampler","assumes","a","uniform","distribution","over","all","transforms",".","They","do","not","need","to","sum","up","to","one","but","weights","need","to","be","positive",".","num_sample_op","(","int",")",":","Number","of","transforms","to","sample","and","apply","to","input",".","randomly_sample_depth","(","bool",")",":","If","randomly_sample_depth","is","True",",","then","uniformly","sample","the","number","of","transforms","to","apply",",","between","1","and","num_sample_op",".","replacement","(","bool",")",":","If","replacement","is","True",",","transforms","are","drawn","with","replacement","."]
code: def __init__(
      self,
      transforms_list: List[Callable],
      transforms_prob: Optional[List[float]] = None,
      num_sample_op: int = 1,
      randomly_sample_depth: bool = False,
      replacement: bool = False,
  ):
      """
      Args:
          transforms_list (List[Callable]): A list of tuples of all available transforms
              to sample from.
          transforms_prob (Optional[List[float]]): The probabilities associated with
              each transform in transforms_list. If not provided, the sampler assumes a
              uniform distribution over all transforms. They do not need to sum up to one
              but weights need to be positive.
          num_sample_op (int): Number of transforms to sample and apply to input.
          randomly_sample_depth (bool): If randomly_sample_depth is True, then uniformly
              sample the number of transforms to apply, between 1 and num_sample_op.
          replacement (bool): If replacement is True, transforms are drawn with replacement.
      """
      super().__init__()
      assert (
          len(transforms_list) > 0
      ), "Argument transforms_list cannot be empty."
      assert num_sample_op > 0, "Need to sample at least one transform."
      assert num_sample_op <= len(
          transforms_list
      ), "Argument num_sample_op cannot be greater than number of available transforms."
  
      if transforms_prob is not None:
          assert len(transforms_list) == len(
              transforms_prob
          ), "Argument transforms_prob needs to have the same length as transforms_list."
  
          assert (
              min(transforms_prob) > 0
          ), "Argument transforms_prob needs to be greater than 0."
  
      self.transforms_list = transforms_list
      self.transforms_prob = torch.FloatTensor(
          transforms_prob
          if transforms_prob is not None
          else [1] * len(transforms_list)
      )
      self.num_sample_op = num_sample_op
      self.randomly_sample_depth = randomly_sample_depth
      self.replacement = replacement
  
imports: from typing import Callable, Dict, List, Optional, Tuple
  import pytorchvideo.transforms.functional
  import torch
  import torchvision.transforms
label_desc: Use image node_id 1 to create a new OpSampler object from inherited base classes: torch.nn with example: obj = OpSampler(transforms_list, transforms_prob, num_sample_op, randomly_sample_depth, replacement)