class_docstr: A pseudo sampler that does not do sampling actually.
class_docstr_tok: ["A","pseudo","sampler","that","does","not","do","sampling","actually","."]
docstr: Directly returns the positive and negative indices  of samples.
  
  Args:
      assign_result (:obj:`AssignResult`): Bbox assigning results.
      pred_instances (:obj:`InstanceData`): Instances of model
          predictions. It includes ``priors``, and the priors can
          be anchors, points, or bboxes predicted by the model,
          shape(n, 4).
      gt_instances (:obj:`InstanceData`): Ground truth of instance
          annotations. It usually includes ``bboxes`` and ``labels``
          attributes.
  
  Returns:
      :obj:`SamplingResult`: sampler results
docstr_tok: ["Directly","returns","the","positive","and","negative","indices","of","samples",".","Args",":","assign_result","(",":","obj",":","`","AssignResult","`",")",":","Bbox","assigning","results",".","pred_instances","(",":","obj",":","`","InstanceData","`",")",":","Instances","of","model","predictions",".","It","includes","``","priors","``",",","and","the","priors","can","be","anchors",",","points",",","or","bboxes","predicted","by","the","model",",","shape","(","n",",","4",")",".","gt_instances","(",":","obj",":","`","InstanceData","`",")",":","Ground","truth","of","instance","annotations",".","It","usually","includes","``","bboxes","``","and","``","labels","``","attributes",".","Returns",":",":","obj",":","`","SamplingResult","`",":","sampler","results"]
code: def sample(
      self,
      assign_result: AssignResult,
      pred_instances: InstanceData,
      gt_instances: InstanceData,
      *args,
      **kwargs,
  ):
      """Directly returns the positive and negative indices  of samples.
  
      Args:
          assign_result (:obj:`AssignResult`): Bbox assigning results.
          pred_instances (:obj:`InstanceData`): Instances of model
              predictions. It includes ``priors``, and the priors can
              be anchors, points, or bboxes predicted by the model,
              shape(n, 4).
          gt_instances (:obj:`InstanceData`): Ground truth of instance
              annotations. It usually includes ``bboxes`` and ``labels``
              attributes.
  
      Returns:
          :obj:`SamplingResult`: sampler results
      """
      gt_bboxes = gt_instances.bboxes
      priors = pred_instances.priors
  
      pos_inds = (
          torch.nonzero(assign_result.gt_inds > 0, as_tuple=False)
          .squeeze(-1)
          .unique()
      )
      neg_inds = (
          torch.nonzero(assign_result.gt_inds == 0, as_tuple=False)
          .squeeze(-1)
          .unique()
      )
  
      gt_flags = priors.new_zeros(priors.shape[0], dtype=torch.uint8)
      sampling_result = SamplingResult(
          pos_inds=pos_inds,
          neg_inds=neg_inds,
          priors=priors,
          gt_bboxes=gt_bboxes,
          assign_result=assign_result,
          gt_flags=gt_flags,
          avg_factor_with_neg=False,
      )
      return sampling_result
  
file_path: mmdetection/mmdet/models/task_modules/samplers/pseudo_sampler.py
imports: import torch
  from mmengine.structures import InstanceData
  from mmdet.registry import TASK_UTILS
  from ..assigners import AssignResult
  from .base_sampler import BaseSampler
  from .sampling_result import SamplingResult
label_desc: Use image node_id 4 for calling the PseudoSampler obj's underlying member method code with example usage: obj.sample(assign_result, pred_instances, gt_instances) and returns: sampling_result