class_docstr: Position 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`.
      mask (bool): Whether to mask input features according to
          ``img_meta['valid_ratio']``.
      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
      
class_docstr_tok: ["Position","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","`",".","mask","(","bool",")",":","Whether","to","mask","input","features","according","to","``","img_meta","[","'valid_ratio","'","]","``",".","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"]
code: def _get_position_index(self, length, batch_size):
      position_index_list = []
      for i in range(batch_size):
          position_index = paddle.arange(
              0, end=length, step=1, dtype="int64"
          )
          position_index_list.append(position_index)
      batch_position_index = paddle.stack(position_index_list, axis=0)
      return batch_position_index
  
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 2 for calling the PositionAttentionDecoder obj's underlying member method code with example usage: obj._get_position_index(length, batch_size) and returns: batch_position_index