class_docstr: Random sampler.
  
  Args:
      num (int): Number of samples
      pos_fraction (float): Fraction of positive samples
      neg_pos_up (int): Upper bound number of negative and
          positive samples. Defaults to -1.
      add_gt_as_proposals (bool): Whether to add ground truth
          boxes as proposals. Defaults to True.
class_docstr_tok: ["Random","sampler",".","Args",":","num","(","int",")",":","Number","of","samples","pos_fraction","(","float",")",":","Fraction","of","positive","samples","neg_pos_up","(","int",")",":","Upper","bound","number","of","negative","and","positive","samples",".","Defaults","to","-1.","add_gt_as_proposals","(","bool",")",":","Whether","to","add","ground","truth","boxes","as","proposals",".","Defaults","to","True","."]
code: def __init__(
      self,
      num: int,
      pos_fraction: float,
      neg_pos_ub: int = -1,
      add_gt_as_proposals: bool = True,
      **kwargs,
  ):
      from .sampling_result import ensure_rng
  
      super().__init__(
          num=num,
          pos_fraction=pos_fraction,
          neg_pos_ub=neg_pos_ub,
          add_gt_as_proposals=add_gt_as_proposals,
      )
      self.rng = ensure_rng(kwargs.get("rng", None))
  
file_path: mmdetection/mmdet/models/task_modules/samplers/random_sampler.py
imports: from typing import Union
  import torch
  from numpy import ndarray
  from torch import Tensor
  from mmdet.registry import TASK_UTILS
  from ..assigners import AssignResult
  from .base_sampler import BaseSampler
label_desc: Use image node_id 1 to create a new RandomSampler object from inherited base classes: BaseSampler with example: obj = RandomSampler(num, pos_fraction, neg_pos_ub, add_gt_as_proposals)