class_docstr: This code is based on
  https://github.com/fcjian/TOOD/blob/master/mmdet/models/dense_heads/tood_head.py
class_docstr_tok: ["This","code","is","based","on","https",":","\/\/github.com\/fcjian\/TOOD\/blob\/master\/mmdet\/models\/dense_heads\/tood_head.py"]
code: def __init__(
      self,
      num_classes=80,
      feat_channels=256,
      stacked_convs=6,
      fpn_strides=(8, 16, 32, 64, 128),
      grid_cell_scale=8,
      grid_cell_offset=0.5,
      norm_type="gn",
      norm_groups=32,
      static_assigner_epoch=4,
      use_align_head=True,
      loss_weight={
          "class": 1.0,
          "bbox": 1.0,
          "iou": 2.0,
      },
      nms="MultiClassNMS",
      static_assigner="ATSSAssigner",
      assigner="TaskAlignedAssigner",
  ):
      super(TOODHead, self).__init__()
      self.num_classes = num_classes
      self.feat_channels = feat_channels
      self.stacked_convs = stacked_convs
      self.fpn_strides = fpn_strides
      self.grid_cell_scale = grid_cell_scale
      self.grid_cell_offset = grid_cell_offset
      self.static_assigner_epoch = static_assigner_epoch
      self.use_align_head = use_align_head
      self.nms = nms
      self.static_assigner = static_assigner
      self.assigner = assigner
      self.loss_weight = loss_weight
      self.giou_loss = GIoULoss()
  
      self.inter_convs = nn.LayerList()
      for i in range(self.stacked_convs):
          self.inter_convs.append(
              ConvNormLayer(
                  self.feat_channels,
                  self.feat_channels,
                  filter_size=3,
                  stride=1,
                  norm_type=norm_type,
                  norm_groups=norm_groups,
              )
          )
  
      self.cls_decomp = TaskDecomposition(
          self.feat_channels,
          self.stacked_convs,
          self.stacked_convs * 8,
          norm_type=norm_type,
          norm_groups=norm_groups,
      )
      self.reg_decomp = TaskDecomposition(
          self.feat_channels,
          self.stacked_convs,
          self.stacked_convs * 8,
          norm_type=norm_type,
          norm_groups=norm_groups,
      )
  
      self.tood_cls = nn.Conv2D(
          self.feat_channels, self.num_classes, 3, padding=1
      )
      self.tood_reg = nn.Conv2D(self.feat_channels, 4, 3, padding=1)
  
      if self.use_align_head:
          self.cls_prob_conv1 = nn.Conv2D(
              self.feat_channels * self.stacked_convs,
              self.feat_channels // 4,
              1,
          )
          self.cls_prob_conv2 = nn.Conv2D(
              self.feat_channels // 4, 1, 3, padding=1
          )
          self.reg_offset_conv1 = nn.Conv2D(
              self.feat_channels * self.stacked_convs,
              self.feat_channels // 4,
              1,
          )
          self.reg_offset_conv2 = nn.Conv2D(
              self.feat_channels // 4, 4 * 2, 3, padding=1
          )
  
      self.scales_regs = nn.LayerList(
          [ScaleReg() for _ in self.fpn_strides]
      )
  
      self._init_weights()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddle import ParamAttr
  from paddle.nn.initializer import Constant
  from ppdet.core.workspace import register
  from ..initializer import normal_, constant_, bias_init_with_prob
  from ppdet.modeling.bbox_utils import bbox_center, batch_distance2bbox
  from ..losses import GIoULoss
  from ppdet.modeling.layers import ConvNormLayer
  from ppdet.modeling.ops import get_static_shape
  from ppdet.modeling.assigners.utils import generate_anchors_for_grid_cell
label_desc: Use image node_id 1 to create a new TOODHead object from inherited base classes: nn with example: obj = TOODHead(num_classes, feat_channels, stacked_convs, fpn_strides, grid_cell_scale, grid_cell_offset, norm_type, norm_groups, static_assigner_epoch, use_align_head, loss_weight, nms, static_assigner, assigner)