class_docstr: Decoder for RobustScanner.
  
  RobustScanner: `RobustScanner: Dynamically Enhancing Positional Clues for
  Robust Text Recognition <https://arxiv.org/abs/2007.07542>`_
  
  Args:
      num_classes (int): Number of output classes :math:`C`.
      dim_input (int): Dimension :math:`D_i` of input vector ``feat``.
      dim_model (int): Dimension :math:`D_m` of the model. Should also be the
          same as encoder output vector ``out_enc``.
      max_seq_len (int): Maximum output sequence length :math:`T`.
      start_idx (int): The index of `<SOS>`.
      mask (bool): Whether to mask input features according to
          ``img_meta['valid_ratio']``.
      padding_idx (int): The index of `<PAD>`.
      encode_value (bool): Whether to use the output of encoder ``out_enc``
          as `value` of attention layer. If False, the original feature
          ``feat`` will be used.
  
  Warning:
      This decoder will not predict the final class which is assumed to be
      `<PAD>`. Therefore, its output size is always :math:`C - 1`. `<PAD>`
      is also ignored by loss as specified in
      :obj:`mmocr.models.textrecog.recognizer.EncodeDecodeRecognizer`.
code: def __init__(
      self,
      num_classes=None,
      dim_input=512,
      dim_model=128,
      hybrid_decoder_rnn_layers=2,
      hybrid_decoder_dropout=0,
      position_decoder_rnn_layers=2,
      max_seq_len=40,
      start_idx=0,
      mask=True,
      padding_idx=None,
      encode_value=False,
  ):
      super().__init__()
      self.num_classes = num_classes
      self.dim_input = dim_input
      self.dim_model = dim_model
      self.max_seq_len = max_seq_len
      self.encode_value = encode_value
      self.start_idx = start_idx
      self.padding_idx = padding_idx
      self.mask = mask
  
      # init hybrid decoder
      self.hybrid_decoder = SequenceAttentionDecoder(
          num_classes=num_classes,
          rnn_layers=hybrid_decoder_rnn_layers,
          dim_input=dim_input,
          dim_model=dim_model,
          max_seq_len=max_seq_len,
          start_idx=start_idx,
          mask=mask,
          padding_idx=padding_idx,
          dropout=hybrid_decoder_dropout,
          encode_value=encode_value,
          return_feature=True,
      )
  
      # init position decoder
      self.position_decoder = PositionAttentionDecoder(
          num_classes=num_classes,
          rnn_layers=position_decoder_rnn_layers,
          dim_input=dim_input,
          dim_model=dim_model,
          max_seq_len=max_seq_len,
          mask=mask,
          encode_value=encode_value,
          return_feature=True,
      )
  
      self.fusion_module = RobustScannerFusionLayer(
          self.dim_model if encode_value else dim_input
      )
  
      pred_num_classes = num_classes - 1
      self.prediction = nn.Linear(
          dim_model if encode_value else dim_input, pred_num_classes
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import paddle
  from paddle import ParamAttr
  import paddle.nn
  import paddle.nn.functional
label_desc: Use image node_id 1 to create a new RobustScannerDecoder object from inherited base classes: BaseDecoder with example: obj = RobustScannerDecoder(num_classes, dim_input, dim_model, hybrid_decoder_rnn_layers, hybrid_decoder_dropout, position_decoder_rnn_layers, max_seq_len, start_idx, mask, padding_idx, encode_value)