class_docstr: Sequence attention 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`.
      rnn_layers (int): Number of RNN layers.
      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>`.
      dropout (float): Dropout rate.
      return_feature (bool): Return feature or logits as the result.
      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`.
class_docstr_tok: ["Sequence","attention","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","`",".","rnn_layers","(","int",")",":","Number","of","RNN","layers",".","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",">","`",".","dropout","(","float",")",":","Dropout","rate",".","return_feature","(","bool",")",":","Return","feature","or","logits","as","the","result",".","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","`","."]
docstr: Args:
      feat (Tensor): Tensor of shape :math:`(N, D_i, H, W)`.
      out_enc (Tensor): Encoder output of shape
          :math:`(N, D_m, H, W)`.
      valid_ratios (Tensor): valid length ratio of img.
  
  Returns:
      Tensor: The output logit sequence tensor of shape
      :math:`(N, T, C-1)`.
docstr_tok: ["Args",":","feat","(","Tensor",")",":","Tensor","of","shape",":","math",":","`","(","N",",","D_i",",","H",",","W",")","`",".","out_enc","(","Tensor",")",":","Encoder","output","of","shape",":","math",":","`","(","N",",","D_m",",","H",",","W",")","`",".","valid_ratios","(","Tensor",")",":","valid","length","ratio","of","img",".","Returns",":","Tensor",":","The","output","logit","sequence","tensor","of","shape",":","math",":","`","(","N",",","T",",","C-1",")","`","."]
code: def forward_test(self, feat, out_enc, valid_ratios):
      """
      Args:
          feat (Tensor): Tensor of shape :math:`(N, D_i, H, W)`.
          out_enc (Tensor): Encoder output of shape
              :math:`(N, D_m, H, W)`.
          valid_ratios (Tensor): valid length ratio of img.
  
      Returns:
          Tensor: The output logit sequence tensor of shape
          :math:`(N, T, C-1)`.
      """
      seq_len = self.max_seq_len
      batch_size = feat.shape[0]
  
      decode_sequence = (
          paddle.ones((batch_size, seq_len), dtype="int64")
          * self.start_idx
      )
  
      outputs = []
      for i in range(seq_len):
          step_out = self.forward_test_step(
              feat, out_enc, decode_sequence, i, valid_ratios
          )
          outputs.append(step_out)
          max_idx = paddle.argmax(step_out, axis=1, keepdim=False)
          if i < seq_len - 1:
              decode_sequence[:, i + 1] = max_idx
  
      outputs = paddle.stack(outputs, 1)
  
      return outputs
  
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 3 for calling the SequenceAttentionDecoder obj's underlying member method code with example usage: obj.forward_test(feat, out_enc, valid_ratios) and returns: outputs