class_docstr: Random sampler.
  
  Args:
      num (int): Number of samples
      pos_fraction (float): Fraction of positive samples
      neg_pos_up (int, optional): Upper bound number of negative and
          positive samples. Defaults to -1.
      add_gt_as_proposals (bool, optional): Whether to add ground truth
          boxes as proposals. Defaults to True.
docstr: Randomly sample some positive samples.
docstr_tok: ["Randomly","sample","some","positive","samples","."]
code: def _sample_pos(self, assign_result, num_expected, **kwargs):
      """Randomly sample some positive samples."""
      pos_inds = torch.nonzero(
          assign_result.gt_inds > 0, as_tuple=False
      )
      if pos_inds.numel() != 0:
          pos_inds = pos_inds.squeeze(1)
      if pos_inds.numel() <= num_expected:
          return pos_inds
      else:
          return self.random_choice(pos_inds, num_expected)
  
file_path: insightface/detection/scrfd/mmdet/core/bbox/samplers/random_sampler.py
imports: import torch
  from ..builder import BBOX_SAMPLERS
  from .base_sampler import BaseSampler
label_desc: Use image node_id 3 for calling the RandomSampler obj's underlying member method code with example usage: obj._sample_pos(assign_result, num_expected) and returns: pos_inds, self