class_docstr: Generalized Focal Loss: Learning Qualified and Distributed Bounding
  Boxes for Dense Object Detection.
  
  GFL head structure is similar with ATSS, however GFL uses
  1) joint representation for classification and localization quality, and
  2) flexible General distribution for bounding box locations,
  which are supervised by
  Quality Focal Loss (QFL) and Distribution Focal Loss (DFL), respectively
  
  https://arxiv.org/abs/2006.04388
  
  Args:
      num_classes (int): Number of categories excluding the background
          category.
      in_channels (int): Number of channels in the input feature map.
      stacked_convs (int): Number of conv layers in cls and reg tower.
          Defaults to 4.
      conv_cfg (:obj:`ConfigDict` or dict, optional): dictionary to construct
          and config conv layer. Defaults to None.
      norm_cfg (:obj:`ConfigDict` or dict): dictionary to construct and
          config norm layer. Default: dict(type='GN', num_groups=32,
          requires_grad=True).
      loss_qfl (:obj:`ConfigDict` or dict): Config of Quality Focal Loss
          (QFL).
      bbox_coder (:obj:`ConfigDict` or dict): Config of bbox coder. Defaults
           to 'DistancePointBBoxCoder'.
      reg_max (int): Max value of integral set :math: ``{0, ..., reg_max}``
          in QFL setting. Defaults to 16.
      init_cfg (:obj:`ConfigDict` or dict or list[dict] or
          list[:obj:`ConfigDict`]): Initialization config dict.
  Example:
      >>> self = GFLHead(11, 7)
      >>> feats = [torch.rand(1, 7, s, s) for s in [4, 8, 16, 32, 64]]
      >>> cls_quality_score, bbox_pred = self.forward(feats)
      >>> assert len(cls_quality_score) == len(self.scales)
class_docstr_tok: ["Generalized","Focal","Loss",":","Learning","Qualified","and","Distributed","Bounding","Boxes","for","Dense","Object","Detection",".","GFL","head","structure","is","similar","with","ATSS",",","however","GFL","uses","1",")","joint","representation","for","classification","and","localization","quality",",","and","2",")","flexible","General","distribution","for","bounding","box","locations",",","which","are","supervised","by","Quality","Focal","Loss","(","QFL",")","and","Distribution","Focal","Loss","(","DFL",")",",","respectively","https",":","\/\/arxiv.org\/abs\/2006.04388","Args",":","num_classes","(","int",")",":","Number","of","categories","excluding","the","background","category",".","in_channels","(","int",")",":","Number","of","channels","in","the","input","feature","map",".","stacked_convs","(","int",")",":","Number","of","conv","layers","in","cls","and","reg","tower",".","Defaults","to","4.","conv_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","dictionary","to","construct","and","config","conv","layer",".","Defaults","to","None",".","norm_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","dictionary","to","construct","and","config","norm","layer",".","Default",":","dict","(","type='GN","'",",","num_groups=32",",","requires_grad=True",")",".","loss_qfl","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","Quality","Focal","Loss","(","QFL",")",".","bbox_coder","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","bbox","coder",".","Defaults","to","'DistancePointBBoxCoder","'",".","reg_max","(","int",")",":","Max","value","of","integral","set",":","math",":","``","{","0",",","...",",","reg_max","}","``","in","QFL","setting",".","Defaults","to","16.","init_cfg","(",":","obj",":","`","ConfigDict","`","or","dict","or","list","[","dict","]","or","list","[",":","obj",":","`","ConfigDict","`","]",")",":","Initialization","config","dict",".","Example",":",">",">",">","self","=","GFLHead","(","11",",","7",")",">",">",">","feats","=","[","torch.rand","(","1",",","7",",","s",",","s",")","for","s","in","[","4",",","8",",","16",",","32",",","64","]","]",">",">",">","cls_quality_score",",","bbox_pred","=","self.forward","(","feats",")",">",">",">","assert","len","(","cls_quality_score",")","==","len","(","self.scales",")"]
docstr: Forward feature of a single scale level.
  
  Args:
      x (Tensor): Features of a single scale level.
      scale (:obj: `mmcv.cnn.Scale`): Learnable scale module to resize
          the bbox prediction.
  
  Returns:
      tuple:
  
      - cls_score (Tensor): Cls and quality joint scores for a single
        scale level the channel number is num_classes.
      - bbox_pred (Tensor): Box distribution logits for a single scale
        level, the channel number is 4*(n+1), n is max value of
        integral set.
docstr_tok: ["Forward","feature","of","a","single","scale","level",".","Args",":","x","(","Tensor",")",":","Features","of","a","single","scale","level",".","scale","(",":","obj",":","`","mmcv.cnn.Scale","`",")",":","Learnable","scale","module","to","resize","the","bbox","prediction",".","Returns",":","tuple",":","-","cls_score","(","Tensor",")",":","Cls","and","quality","joint","scores","for","a","single","scale","level","the","channel","number","is","num_classes",".","-","bbox_pred","(","Tensor",")",":","Box","distribution","logits","for","a","single","scale","level",",","the","channel","number","is","4","*","(","n+1",")",",","n","is","max","value","of","integral","set","."]
code: def forward_single(self, x: Tensor, scale: Scale) -> Sequence[Tensor]:
      """Forward feature of a single scale level.
  
      Args:
          x (Tensor): Features of a single scale level.
          scale (:obj: `mmcv.cnn.Scale`): Learnable scale module to resize
              the bbox prediction.
  
      Returns:
          tuple:
  
          - cls_score (Tensor): Cls and quality joint scores for a single
            scale level the channel number is num_classes.
          - bbox_pred (Tensor): Box distribution logits for a single scale
            level, the channel number is 4*(n+1), n is max value of
            integral set.
      """
      cls_feat = x
      reg_feat = x
      for cls_conv in self.cls_convs:
          cls_feat = cls_conv(cls_feat)
      for reg_conv in self.reg_convs:
          reg_feat = reg_conv(reg_feat)
      cls_score = self.gfl_cls(cls_feat)
      bbox_pred = scale(self.gfl_reg(reg_feat)).float()
      return cls_score, bbox_pred
  
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 4 for calling the GFLHead obj's underlying member method code with example usage: obj.forward_single(x, scale) and returns: cls_score,  bbox_pred