class_docstr: FPN-like fusion module in Shape Robust Text Detection with Progressive
  Scale Expansion Network.
  
  Args:
      in_channels (list[int]): A list of number of input channels.
          Defaults to [256, 512, 1024, 2048].
      out_channels (int): The number of output channels.
          Defaults to 256.
      fusion_type (str): Type of the final feature fusion layer. Available
          options are "concat" and "add". Defaults to "concat".
      init_cfg (dict or list[dict], optional): Initialization configs.
          Defaults to
          dict(type='Xavier', layer='Conv2d', distribution='uniform')
code: def __init__(
      self,
      in_channels: List[int] = [256, 512, 1024, 2048],
      out_channels: int = 256,
      fusion_type: str = "concat",
      init_cfg: Optional[Union[Dict, List[Dict]]] = dict(
          type="Xavier", layer="Conv2d", distribution="uniform"
      ),
  ) -> None:
      super().__init__(init_cfg=init_cfg)
      conv_cfg = None
      norm_cfg = dict(type="BN")
      act_cfg = dict(type="ReLU")
  
      self.in_channels = in_channels
      self.out_channels = out_channels
  
      self.lateral_convs = ModuleList()
      self.fpn_convs = ModuleList()
      self.backbone_end_level = len(in_channels)
      for i in range(self.backbone_end_level):
          l_conv = ConvModule(
              in_channels[i],
              out_channels,
              1,
              conv_cfg=conv_cfg,
              norm_cfg=norm_cfg,
              act_cfg=act_cfg,
              inplace=False,
          )
          self.lateral_convs.append(l_conv)
  
          if i < self.backbone_end_level - 1:
              fpn_conv = ConvModule(
                  out_channels,
                  out_channels,
                  3,
                  padding=1,
                  conv_cfg=conv_cfg,
                  norm_cfg=norm_cfg,
                  act_cfg=act_cfg,
                  inplace=False,
              )
              self.fpn_convs.append(fpn_conv)
  
      self.fusion_type = fusion_type
  
      if self.fusion_type == "concat":
          feature_channels = 1024
      elif self.fusion_type == "add":
          feature_channels = 256
      else:
          raise NotImplementedError
  
      self.output_convs = ConvModule(
          feature_channels,
          out_channels,
          3,
          padding=1,
          conv_cfg=None,
          norm_cfg=norm_cfg,
          act_cfg=act_cfg,
          inplace=False,
      )
  
file_path: mmocr/mmocr/models/textdet/necks/fpnf.py
imports: from typing import Dict, List, Optional, Union
  import torch
  import torch.nn.functional
  from mmcv.cnn import ConvModule
  from mmengine.model import BaseModule, ModuleList
  from torch import Tensor
  from mmocr.registry import MODELS
label_desc: Use image node_id 1 to create a new FPNF object from inherited base classes: BaseModule with example: obj = FPNF(in_channels, out_channels, fusion_type, init_cfg)