docstr: Arguments:
      in_channels (int): number of channels of the input feature
docstr_tok: ["Arguments",":","in_channels","(","int",")",":","number","of","channels","of","the","input","feature"]
code: def __init__(self, cfg, input_shape: List[ShapeSpec]):
      """
      Arguments:
          in_channels (int): number of channels of the input feature
      """
      super().__init__()
      # TODO: Implement the sigmoid version first.
      self.num_classes = cfg.CONFIG.MODEL.FCOS.NUM_CLASSES
      self.fpn_strides = cfg.CONFIG.MODEL.FCOS.FPN_STRIDES
      head_configs = {
          "cls": (
              cfg.CONFIG.MODEL.FCOS.NUM_CLS_CONVS,
              cfg.CONFIG.MODEL.FCOS.USE_DEFORMABLE,
          ),
          "bbox": (
              cfg.CONFIG.MODEL.FCOS.NUM_BOX_CONVS,
              cfg.CONFIG.MODEL.FCOS.USE_DEFORMABLE,
          ),
          "share": (cfg.CONFIG.MODEL.FCOS.NUM_SHARE_CONVS, False),
      }
      norm = (
          None
          if cfg.CONFIG.MODEL.FCOS.NORM == "none"
          else cfg.CONFIG.MODEL.FCOS.NORM
      )
      self.num_levels = len(input_shape)
  
      in_channels = [s.channels for s in input_shape]
      assert (
          len(set(in_channels)) == 1
      ), "Each level must have the same channel!"
      in_channels = in_channels[0]
  
      self.in_channels_to_top_module = in_channels
  
      for head in head_configs:
          tower = []
          num_convs, use_deformable = head_configs[head]
          for i in range(num_convs):
              if use_deformable and i == num_convs - 1:
                  raise NotImplementedError(
                      "Deformable Conv v2 is not supported yet!"
                  )
              else:
                  conv_func = nn.Conv2d
              tower.append(
                  conv_func(
                      in_channels,
                      in_channels,
                      kernel_size=3,
                      stride=1,
                      padding=1,
                      bias=True,
                  )
              )
              if norm == "GN":
                  tower.append(nn.GroupNorm(32, in_channels))
              elif norm == "NaiveGN":
                  tower.append(NaiveGroupNorm(32, in_channels))
              elif norm == "BN":
                  tower.append(
                      ModuleListDial(
                          [
                              nn.BatchNorm2d(in_channels)
                              for _ in range(self.num_levels)
                          ]
                      )
                  )
              elif norm == "SyncBN":
                  tower.append(
                      ModuleListDial(
                          [
                              NaiveSyncBatchNorm(in_channels)
                              for _ in range(self.num_levels)
                          ]
                      )
                  )
              tower.append(nn.ReLU())
          self.add_module(
              "{}_tower".format(head), nn.Sequential(*tower)
          )
  
      self.cls_logits = nn.Conv2d(
          in_channels,
          self.num_classes,
          kernel_size=3,
          stride=1,
          padding=1,
      )
      self.bbox_pred = nn.Conv2d(
          in_channels, 4, kernel_size=3, stride=1, padding=1
      )
      self.ctrness = nn.Conv2d(
          in_channels, 1, kernel_size=3, stride=1, padding=1
      )
  
      if cfg.CONFIG.MODEL.FCOS.USE_SCALE:
          self.scales = nn.ModuleList(
              [Scale(init_value=1.0) for _ in range(self.num_levels)]
          )
      else:
          self.scales = None
  
      for modules in [
          self.cls_tower,
          self.bbox_tower,
          self.share_tower,
          self.cls_logits,
          self.bbox_pred,
          self.ctrness,
      ]:
          for l in modules.modules():
              if isinstance(l, nn.Conv2d):
                  torch.nn.init.normal_(l.weight, std=0.01)
                  torch.nn.init.constant_(l.bias, 0)
  
      # initialize the bias for focal loss
      prior_prob = cfg.CONFIG.MODEL.FCOS.PRIOR_PROB
      bias_value = -math.log((1 - prior_prob) / prior_prob)
      torch.nn.init.constant_(self.cls_logits.bias, bias_value)
  
imports: import logging
  import math
  from typing import List, Dict
  import torch
  from torch import nn
  from torch.nn import functional
  from ...nn.shape_spec import ShapeSpec
  from ...nn.deform_conv import DeformConvWithChangeableStride
  from ...nn.group_norm import NaiveGroupNorm
  from ...data.structures import Instances, Boxes
  from ...nn.focal_loss import sigmoid_focal_loss_jit
  from ...nn.nms import ml_nms
  from ...utils.loss import IOULoss
  from ...utils.comm import get_world_size, reduce_sum, compute_locations
label_desc: Use image node_id 1 to create a new FCOSHead object from inherited base classes: nn with example: obj = FCOSHead(cfg, input_shape)