class_docstr: Converts visual features into text characters.
  
  Implementation of VisionEncoder in
      `ABINet <https://arxiv.org/abs/2103.06495>`_.
  
  Args:
      dictionary (dict or :obj:`Dictionary`): The config for `Dictionary` or
          the instance of `Dictionary`.
      in_channels (int): Number of channels :math:`E` of input vector.
          Defaults to 512.
      num_channels (int): Number of channels of hidden vectors in mini U-Net.
          Defaults to 64.
      attn_height (int): Height :math:`H` of input image features. Defaults
          to 8.
      attn_width (int): Width :math:`W` of input image features. Defaults to
          32.
      attn_mode (str): Upsampling mode for :obj:`torch.nn.Upsample` in mini
          U-Net. Defaults to 'nearest'.
      module_loss (dict, optional): Config to build loss. Defaults to None.
      postprocessor (dict, optional): Config to build postprocessor.
          Defaults to None.
      max_seq_len (int): Maximum sequence length. The
          sequence is usually generated from decoder. Defaults to 40.
      init_cfg (dict or list[dict], optional): Initialization configs.
          Defaults to dict(type='Xavier', layer='Conv2d').
docstr: Generate decoder layer.
  
  Args:
      in_channels (int): Input channels.
      out_channels (int): Output channels.
      kernel_size (int): Kernel size. Defaults to 3.
      stride (int): Stride. Defaults to 1.
      padding (int): Padding. Defaults to 1.
      mode (str): Interpolation mode. Defaults to 'nearest'.
      scale_factor (int, optional): Scale factor for upsampling.
      size (Tuple[int, int], optional): Output size. Defaults to None.
docstr_tok: ["Generate","decoder","layer",".","Args",":","in_channels","(","int",")",":","Input","channels",".","out_channels","(","int",")",":","Output","channels",".","kernel_size","(","int",")",":","Kernel","size",".","Defaults","to","3.","stride","(","int",")",":","Stride",".","Defaults","to","1.","padding","(","int",")",":","Padding",".","Defaults","to","1.","mode","(","str",")",":","Interpolation","mode",".","Defaults","to","'nearest","'",".","scale_factor","(","int",",","optional",")",":","Scale","factor","for","upsampling",".","size","(","Tuple","[","int",",","int","]",",","optional",")",":","Output","size",".","Defaults","to","None","."]
code: def _decoder_layer(
      self,
      in_channels: int,
      out_channels: int,
      kernel_size: int = 3,
      stride: int = 1,
      padding: int = 1,
      mode: str = "nearest",
      scale_factor: Optional[int] = None,
      size: Optional[Tuple[int, int]] = None,
  ):
      """Generate decoder layer.
  
      Args:
          in_channels (int): Input channels.
          out_channels (int): Output channels.
          kernel_size (int): Kernel size. Defaults to 3.
          stride (int): Stride. Defaults to 1.
          padding (int): Padding. Defaults to 1.
          mode (str): Interpolation mode. Defaults to 'nearest'.
          scale_factor (int, optional): Scale factor for upsampling.
          size (Tuple[int, int], optional): Output size. Defaults to None.
      """
      align_corners = None if mode == "nearest" else True
      return nn.Sequential(
          nn.Upsample(
              size=size,
              scale_factor=scale_factor,
              mode=mode,
              align_corners=align_corners,
          ),
          ConvModule(
              in_channels,
              out_channels,
              kernel_size=kernel_size,
              stride=stride,
              padding=padding,
              norm_cfg=dict(type="BN"),
              act_cfg=dict(type="ReLU"),
          ),
      )
  
file_path: mmocr/mmocr/models/textrecog/decoders/abi_vision_decoder.py
imports: from typing import Dict, List, Optional, Sequence, Tuple, Union
  import torch
  import torch.nn
  from mmcv.cnn import ConvModule
  from mmocr.models.common.dictionary import Dictionary
  from mmocr.models.common.modules import PositionalEncoding
  from mmocr.registry import MODELS
  from mmocr.structures import TextRecogDataSample
  from .base import BaseDecoder
label_desc: Use image node_id 5 for calling the ABIVisionDecoder obj's underlying member method code with example usage: obj._decoder_layer(in_channels, out_channels, kernel_size, stride, padding, mode, scale_factor, size) and returns: nn