class_docstr: YOLOXHead head used in `YOLOX <https://arxiv.org/abs/2107.08430>`_.
  
  Args:
      num_classes (int): Number of categories excluding the background
          category.
      in_channels (int): Number of channels in the input feature map.
      feat_channels (int): Number of hidden channels in stacking convs.
          Defaults to 256
      stacked_convs (int): Number of stacking convs of the head.
          Defaults to (8, 16, 32).
      strides (Sequence[int]): Downsample factor of each feature map.
           Defaults to None.
      use_depthwise (bool): Whether to depthwise separable convolution in
          blocks. Defaults to False.
      dcn_on_last_conv (bool): If true, use dcn in the last layer of
          towers. Defaults to False.
      conv_bias (bool or str): If specified as `auto`, it will be decided by
          the norm_cfg. Bias of conv will be set as True if `norm_cfg` is
          None, otherwise False. Defaults to "auto".
      conv_cfg (:obj:`ConfigDict` or dict, optional): Config dict for
          convolution layer. Defaults to None.
      norm_cfg (:obj:`ConfigDict` or dict): Config dict for normalization
          layer. Defaults to dict(type='BN', momentum=0.03, eps=0.001).
      act_cfg (:obj:`ConfigDict` or dict): Config dict for activation layer.
          Defaults to None.
      loss_cls (:obj:`ConfigDict` or dict): Config of classification loss.
      loss_bbox (:obj:`ConfigDict` or dict): Config of localization loss.
      loss_obj (:obj:`ConfigDict` or dict): Config of objectness loss.
      loss_l1 (:obj:`ConfigDict` or dict): Config of L1 loss.
      train_cfg (:obj:`ConfigDict` or dict, optional): Training config of
          anchor head. Defaults to None.
      test_cfg (:obj:`ConfigDict` or dict, optional): Testing config of
          anchor head. Defaults to None.
      init_cfg (:obj:`ConfigDict` or list[:obj:`ConfigDict`] or dict or
          list[dict], optional): Initialization config dict.
          Defaults to None.
class_docstr_tok: ["YOLOXHead","head","used","in","`","YOLOX","<","https",":","\/\/arxiv.org\/abs\/2107.08430",">","`","_",".","Args",":","num_classes","(","int",")",":","Number","of","categories","excluding","the","background","category",".","in_channels","(","int",")",":","Number","of","channels","in","the","input","feature","map",".","feat_channels","(","int",")",":","Number","of","hidden","channels","in","stacking","convs",".","Defaults","to","256","stacked_convs","(","int",")",":","Number","of","stacking","convs","of","the","head",".","Defaults","to","(","8",",","16",",","32",")",".","strides","(","Sequence","[","int","]",")",":","Downsample","factor","of","each","feature","map",".","Defaults","to","None",".","use_depthwise","(","bool",")",":","Whether","to","depthwise","separable","convolution","in","blocks",".","Defaults","to","False",".","dcn_on_last_conv","(","bool",")",":","If","true",",","use","dcn","in","the","last","layer","of","towers",".","Defaults","to","False",".","conv_bias","(","bool","or","str",")",":","If","specified","as","`","auto","`",",","it","will","be","decided","by","the","norm_cfg",".","Bias","of","conv","will","be","set","as","True","if","`","norm_cfg","`","is","None",",","otherwise","False",".","Defaults","to","``","auto","''",".","conv_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Config","dict","for","convolution","layer",".","Defaults","to","None",".","norm_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","dict","for","normalization","layer",".","Defaults","to","dict","(","type='BN","'",",","momentum=0.03",",","eps=0.001",")",".","act_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","dict","for","activation","layer",".","Defaults","to","None",".","loss_cls","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","classification","loss",".","loss_bbox","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","localization","loss",".","loss_obj","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","objectness","loss",".","loss_l1","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","L1","loss",".","train_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Training","config","of","anchor","head",".","Defaults","to","None",".","test_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Testing","config","of","anchor","head",".","Defaults","to","None",".","init_cfg","(",":","obj",":","`","ConfigDict","`","or","list","[",":","obj",":","`","ConfigDict","`","]","or","dict","or","list","[","dict","]",",","optional",")",":","Initialization","config","dict",".","Defaults","to","None","."]
docstr: Initialize conv layers of a single level head.
docstr_tok: ["Initialize","conv","layers","of","a","single","level","head","."]
code: def _build_stacked_convs(self) -> nn.Sequential:
      """Initialize conv layers of a single level head."""
      conv = (
          DepthwiseSeparableConvModule
          if self.use_depthwise
          else ConvModule
      )
      stacked_convs = []
      for i in range(self.stacked_convs):
          chn = self.in_channels if i == 0 else self.feat_channels
          if self.dcn_on_last_conv and i == self.stacked_convs - 1:
              conv_cfg = dict(type="DCNv2")
          else:
              conv_cfg = self.conv_cfg
          stacked_convs.append(
              conv(
                  chn,
                  self.feat_channels,
                  3,
                  stride=1,
                  padding=1,
                  conv_cfg=conv_cfg,
                  norm_cfg=self.norm_cfg,
                  act_cfg=self.act_cfg,
                  bias=self.conv_bias,
              )
          )
      return nn.Sequential(*stacked_convs)
  
imports: import math
  from typing import List, Optional, Sequence, Tuple, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule
  from mmcv.ops.nms import batched_nms
  from mmengine.config import ConfigDict
  from mmengine.model import bias_init_with_prob
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.registry import MODELS, TASK_UTILS
  from mmdet.structures.bbox import bbox_xyxy_to_cxcywh
  from mmdet.utils import ConfigType, OptConfigType, OptInstanceList, OptMultiConfig, reduce_mean
  from ..task_modules.prior_generators import MlvlPointGenerator
  from ..task_modules.samplers import PseudoSampler
  from ..utils import multi_apply
  from .base_dense_head import BaseDenseHead
label_desc: Use image node_id 3 for calling the YOLOXHead obj's underlying member method code with example usage: obj._build_stacked_convs() and returns: nn