class_docstr: A fixed layer for calculating integral result from distribution.
  
  This layer calculates the target location by :math: ``sum{P(y_i) * y_i}``,
  P(y_i) denotes the softmax vector that represents the discrete distribution
  y_i denotes the discrete set, usually {0, 1, 2, ..., reg_max}
  
  Args:
      reg_max (int): The maximal value of the discrete set. Defaults to 16.
          You may want to reset it according to your new dataset or related
          settings.
class_docstr_tok: ["A","fixed","layer","for","calculating","integral","result","from","distribution",".","This","layer","calculates","the","target","location","by",":","math",":","``","sum","{","P","(","y_i",")","*","y_i","}","``",",","P","(","y_i",")","denotes","the","softmax","vector","that","represents","the","discrete","distribution","y_i","denotes","the","discrete","set",",","usually","{","0",",","1",",","2",",","...",",","reg_max","}","Args",":","reg_max","(","int",")",":","The","maximal","value","of","the","discrete","set",".","Defaults","to","16",".","You","may","want","to","reset","it","according","to","your","new","dataset","or","related","settings","."]
docstr: Forward feature from the regression head to get integral result of
  bounding box location.
  
  Args:
      x (Tensor): Features of the regression head, shape (N, 4*(n+1)),
          n is self.reg_max.
  
  Returns:
      x (Tensor): Integral result of box locations, i.e., distance
          offsets from the box center in four directions, shape (N, 4).
docstr_tok: ["Forward","feature","from","the","regression","head","to","get","integral","result","of","bounding","box","location",".","Args",":","x","(","Tensor",")",":","Features","of","the","regression","head",",","shape","(","N",",","4","*","(","n+1",")",")",",","n","is","self.reg_max",".","Returns",":","x","(","Tensor",")",":","Integral","result","of","box","locations",",","i.e.",",","distance","offsets","from","the","box","center","in","four","directions",",","shape","(","N",",","4",")","."]
code: def forward(self, x: Tensor) -> Tensor:
      """Forward feature from the regression head to get integral result of
      bounding box location.
  
      Args:
          x (Tensor): Features of the regression head, shape (N, 4*(n+1)),
              n is self.reg_max.
  
      Returns:
          x (Tensor): Integral result of box locations, i.e., distance
              offsets from the box center in four directions, shape (N, 4).
      """
      x = F.softmax(x.reshape(-1, self.reg_max + 1), dim=1)
      x = F.linear(x, self.project.type_as(x)).reshape(-1, 4)
      return x
  
imports: from typing import List, Optional, Sequence, Tuple
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import ConvModule, Scale
  from mmengine.config import ConfigDict
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.registry import MODELS, TASK_UTILS
  from mmdet.structures.bbox import bbox_overlaps
  from mmdet.utils import ConfigType, InstanceList, MultiConfig, OptConfigType, OptInstanceList, reduce_mean
  from ..task_modules.prior_generators import anchor_inside_flags
  from ..task_modules.samplers import PseudoSampler
  from ..utils import filter_scores_and_topk, images_to_levels, multi_apply, unmap
  from .anchor_head import AnchorHead
label_desc: Use image node_id 2 for calling the Integral obj's underlying member method code with example usage: obj.forward(x) and returns: x