class_docstr: Mask sampling result.
code: def __init__(
      self,
      pos_inds: Tensor,
      neg_inds: Tensor,
      masks: Tensor,
      gt_masks: Tensor,
      assign_result: AssignResult,
      gt_flags: Tensor,
      avg_factor_with_neg: bool = True,
  ) -> None:
      self.pos_inds = pos_inds
      self.neg_inds = neg_inds
      self.num_pos = max(pos_inds.numel(), 1)
      self.num_neg = max(neg_inds.numel(), 1)
      self.avg_factor = (
          self.num_pos + self.num_neg
          if avg_factor_with_neg
          else self.num_pos
      )
  
      self.pos_masks = masks[pos_inds]
      self.neg_masks = masks[neg_inds]
      self.pos_is_gt = gt_flags[pos_inds]
  
      self.num_gts = gt_masks.shape[0]
      self.pos_assigned_gt_inds = assign_result.gt_inds[pos_inds] - 1
  
      if gt_masks.numel() == 0:
          # hack for index error case
          assert self.pos_assigned_gt_inds.numel() == 0
          self.pos_gt_masks = torch.empty_like(gt_masks)
      else:
          self.pos_gt_masks = gt_masks[self.pos_assigned_gt_inds, :]
  
file_path: mmdetection/mmdet/models/task_modules/samplers/mask_sampling_result.py
imports: import torch
  from torch import Tensor
  from ..assigners import AssignResult
  from .sampling_result import SamplingResult
label_desc: Use image node_id 1 to create a new MaskSamplingResult object from inherited base classes: SamplingResult with example: obj = MaskSamplingResult(pos_inds, neg_inds, masks, gt_masks, assign_result, gt_flags, avg_factor_with_neg)