class_docstr: Args:
      out_channels (int): Output class number.
      enc_bi_rnn (bool): If True, use bidirectional RNN in encoder.
      dec_bi_rnn (bool): If True, use bidirectional RNN in decoder.
      dec_drop_rnn (float): Dropout of RNN layer in decoder.
      dec_gru (bool): If True, use GRU, else LSTM in decoder.
      d_model (int): Dim of channels from backbone.
      d_enc (int): Dim of encoder RNN layer.
      d_k (int): Dim of channels of attention module.
      pred_dropout (float): Dropout probability of prediction layer.
      max_seq_len (int): Maximum sequence length for decoding.
      mask (bool): If True, mask padding in feature map.
      start_idx (int): Index of start token.
      padding_idx (int): Index of padding token.
      pred_concat (bool): If True, concat glimpse feature from
          attention with holistic feature and hidden state.
class_docstr_tok: ["Args",":","out_channels","(","int",")",":","Output","class","number",".","enc_bi_rnn","(","bool",")",":","If","True",",","use","bidirectional","RNN","in","encoder",".","dec_bi_rnn","(","bool",")",":","If","True",",","use","bidirectional","RNN","in","decoder",".","dec_drop_rnn","(","float",")",":","Dropout","of","RNN","layer","in","decoder",".","dec_gru","(","bool",")",":","If","True",",","use","GRU",",","else","LSTM","in","decoder",".","d_model","(","int",")",":","Dim","of","channels","from","backbone",".","d_enc","(","int",")",":","Dim","of","encoder","RNN","layer",".","d_k","(","int",")",":","Dim","of","channels","of","attention","module",".","pred_dropout","(","float",")",":","Dropout","probability","of","prediction","layer",".","max_seq_len","(","int",")",":","Maximum","sequence","length","for","decoding",".","mask","(","bool",")",":","If","True",",","mask","padding","in","feature","map",".","start_idx","(","int",")",":","Index","of","start","token",".","padding_idx","(","int",")",":","Index","of","padding","token",".","pred_concat","(","bool",")",":","If","True",",","concat","glimpse","feature","from","attention","with","holistic","feature","and","hidden","state","."]
docstr: img_metas: [label, valid_ratio]
docstr_tok: ["img_metas",":","[","label",",","valid_ratio","]"]
code: def forward_train(self, feat, out_enc, label, img_metas):
      """
      img_metas: [label, valid_ratio]
      """
      if img_metas is not None:
          assert paddle.shape(img_metas[0])[0] == paddle.shape(feat)[0]
  
      valid_ratios = None
      if img_metas is not None and self.mask:
          valid_ratios = img_metas[-1]
  
      lab_embedding = self.embedding(label)
      # bsz * seq_len * emb_dim
      out_enc = out_enc.unsqueeze(1).astype(lab_embedding.dtype)
      # bsz * 1 * emb_dim
      in_dec = paddle.concat((out_enc, lab_embedding), axis=1)
      # bsz * (seq_len + 1) * C
      out_dec = self._2d_attention(
          in_dec, feat, out_enc, valid_ratios=valid_ratios
      )
  
      return out_dec[:, 1:, :]
  
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 ParallelSARDecoder obj's underlying member method code with example usage: obj.forward_train(feat, out_enc, label, img_metas) and returns: out_dec