class_docstr: Center Weighting module to adjust the category-specific prior
  distributions.
  
  Args:
      force_topk (bool): When no point falls into gt_bbox, forcibly
          select the k points closest to the center to calculate
          the center prior. Defaults to False.
      topk (int): The number of points used to calculate the
          center prior when no point falls in gt_bbox. Only work when
          force_topk if True. Defaults to 9.
      num_classes (int): The class number of dataset. Defaults to 80.
      strides (Sequence[int]): The stride of each input feature map.
          Defaults to (8, 16, 32, 64, 128).
class_docstr_tok: ["Center","Weighting","module","to","adjust","the","category-specific","prior","distributions",".","Args",":","force_topk","(","bool",")",":","When","no","point","falls","into","gt_bbox",",","forcibly","select","the","k","points","closest","to","the","center","to","calculate","the","center","prior",".","Defaults","to","False",".","topk","(","int",")",":","The","number","of","points","used","to","calculate","the","center","prior","when","no","point","falls","in","gt_bbox",".","Only","work","when","force_topk","if","True",".","Defaults","to","9.","num_classes","(","int",")",":","The","class","number","of","dataset",".","Defaults","to","80.","strides","(","Sequence","[","int","]",")",":","The","stride","of","each","input","feature","map",".","Defaults","to","(","8",",","16",",","32",",","64",",","128",")","."]
docstr: Get the center prior of each point on the feature map for each
  instance.
  
  Args:
      anchor_points_list (list[Tensor]): list of coordinate
          of points on feature map. Each with shape
          (num_points, 2).
      gt_instances (:obj:`InstanceData`): Ground truth of instance
          annotations. It should includes ``bboxes`` and ``labels``
          attributes.
      inside_gt_bbox_mask (Tensor): Tensor of bool type,
          with shape of (num_points, num_gt), each
          value is used to mark whether this point falls
          within a certain gt.
  
  Returns:
      tuple[Tensor, Tensor]:
  
      - center_prior_weights(Tensor): Float tensor with shape  of             (num_points, num_gt). Each value represents the center             weighting coefficient.
      - inside_gt_bbox_mask (Tensor): Tensor of bool type, with shape             of (num_points, num_gt), each value is used to mark whether this             point falls within a certain gt or is the topk nearest points for             a specific gt_bbox.
docstr_tok: ["Get","the","center","prior","of","each","point","on","the","feature","map","for","each","instance",".","Args",":","anchor_points_list","(","list","[","Tensor","]",")",":","list","of","coordinate","of","points","on","feature","map",".","Each","with","shape","(","num_points",",","2",")",".","gt_instances","(",":","obj",":","`","InstanceData","`",")",":","Ground","truth","of","instance","annotations",".","It","should","includes","``","bboxes","``","and","``","labels","``","attributes",".","inside_gt_bbox_mask","(","Tensor",")",":","Tensor","of","bool","type",",","with","shape","of","(","num_points",",","num_gt",")",",","each","value","is","used","to","mark","whether","this","point","falls","within","a","certain","gt",".","Returns",":","tuple","[","Tensor",",","Tensor","]",":","-","center_prior_weights","(","Tensor",")",":","Float","tensor","with","shape","of","(","num_points",",","num_gt",")",".","Each","value","represents","the","center","weighting","coefficient",".","-","inside_gt_bbox_mask","(","Tensor",")",":","Tensor","of","bool","type",",","with","shape","of","(","num_points",",","num_gt",")",",","each","value","is","used","to","mark","whether","this","point","falls","within","a","certain","gt","or","is","the","topk","nearest","points","for","a","specific","gt_bbox","."]
code: def forward(
      self,
      anchor_points_list: List[Tensor],
      gt_instances: InstanceData,
      inside_gt_bbox_mask: Tensor,
  ) -> Tuple[Tensor, Tensor]:
      """Get the center prior of each point on the feature map for each
          instance.
  
          Args:
              anchor_points_list (list[Tensor]): list of coordinate
                  of points on feature map. Each with shape
                  (num_points, 2).
              gt_instances (:obj:`InstanceData`): Ground truth of instance
                  annotations. It should includes ``bboxes`` and ``labels``
                  attributes.
              inside_gt_bbox_mask (Tensor): Tensor of bool type,
                  with shape of (num_points, num_gt), each
                  value is used to mark whether this point falls
                  within a certain gt.
  
          Returns:
              tuple[Tensor, Tensor]:
  
              - center_prior_weights(Tensor): Float tensor with shape  of \
              (num_points, num_gt). Each value represents the center \
              weighting coefficient.
              - inside_gt_bbox_mask (Tensor): Tensor of bool type, with shape \
              of (num_points, num_gt), each value is used to mark whether this \
              point falls within a certain gt or is the topk nearest points for \
              a specific gt_bbox.
          """
      gt_bboxes = gt_instances.bboxes
      labels = gt_instances.labels
  
      inside_gt_bbox_mask = inside_gt_bbox_mask.clone()
      num_gts = len(labels)
      num_points = sum([len(item) for item in anchor_points_list])
      if num_gts == 0:
          return (
              gt_bboxes.new_zeros(num_points, num_gts),
              inside_gt_bbox_mask,
          )
      center_prior_list = []
      for slvl_points, stride in zip(anchor_points_list, self.strides):
          # slvl_points: points from single level in FPN, has shape (h*w, 2)
          # single_level_points has shape (h*w, num_gt, 2)
          single_level_points = slvl_points[:, None, :].expand(
              (slvl_points.size(0), len(gt_bboxes), 2)
          )
          gt_center_x = (gt_bboxes[:, 0] + gt_bboxes[:, 2]) / 2
          gt_center_y = (gt_bboxes[:, 1] + gt_bboxes[:, 3]) / 2
          gt_center = torch.stack((gt_center_x, gt_center_y), dim=1)
          gt_center = gt_center[None]
          # instance_center has shape (1, num_gt, 2)
          instance_center = self.mean[labels][None]
          # instance_sigma has shape (1, num_gt, 2)
          instance_sigma = self.sigma[labels][None]
          # distance has shape (num_points, num_gt, 2)
          distance = (
              (single_level_points - gt_center) / float(stride)
              - instance_center
          ) ** 2
          center_prior = torch.exp(
              -distance / (2 * instance_sigma**2)
          ).prod(dim=-1)
          center_prior_list.append(center_prior)
      center_prior_weights = torch.cat(center_prior_list, dim=0)
  
      if self.force_topk:
          gt_inds_no_points_inside = torch.nonzero(
              inside_gt_bbox_mask.sum(0) == 0
          ).reshape(-1)
          if gt_inds_no_points_inside.numel():
              topk_center_index = center_prior_weights[
                  :, gt_inds_no_points_inside
              ].topk(self.topk, dim=0)[1]
              temp_mask = inside_gt_bbox_mask[
                  :, gt_inds_no_points_inside
              ]
              inside_gt_bbox_mask[
                  :, gt_inds_no_points_inside
              ] = torch.scatter(
                  temp_mask,
                  dim=0,
                  index=topk_center_index,
                  src=torch.ones_like(
                      topk_center_index, dtype=torch.bool
                  ),
              )
  
      center_prior_weights[~inside_gt_bbox_mask] = 0
      return center_prior_weights, inside_gt_bbox_mask
  
imports: from typing import Dict, List, Sequence, Tuple
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import Scale
  from mmengine.model import bias_init_with_prob, normal_init
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures.bbox import bbox_overlaps
  from mmdet.utils import InstanceList, OptInstanceList, reduce_mean
  from ..task_modules.prior_generators import MlvlPointGenerator
  from ..utils import levels_to_images, multi_apply
  from .fcos_head import FCOSHead
label_desc: Use image node_id 2 for calling the CenterPrior obj's underlying member method code with example usage: obj.forward(anchor_points_list, gt_instances, inside_gt_bbox_mask) and returns: center_prior_weights,  inside_gt_bbox_mask, gt_bboxes,  inside_gt_bbox_mask