code: def __init__(
      self,
      ratio,
      is_train,
      input_size,
      hidden_size,
      encoder_out_channel,
      dropout,
      dropout_ratio,
      word_num,
      counting_decoder_out_channel,
      attention,
  ):
      super(AttDecoder, self).__init__()
      self.input_size = input_size
      self.hidden_size = hidden_size
      self.out_channel = encoder_out_channel
      self.attention_dim = attention["attention_dim"]
      self.dropout_prob = dropout
      self.ratio = ratio
      self.word_num = word_num
  
      self.counting_num = counting_decoder_out_channel
      self.is_train = is_train
  
      self.init_weight = nn.Linear(self.out_channel, self.hidden_size)
      self.embedding = nn.Embedding(self.word_num, self.input_size)
      self.word_input_gru = nn.GRUCell(
          self.input_size, self.hidden_size
      )
      self.word_attention = Attention(
          hidden_size, attention["attention_dim"]
      )
  
      self.encoder_feature_conv = nn.Conv2D(
          self.out_channel,
          self.attention_dim,
          kernel_size=attention["word_conv_kernel"],
          padding=attention["word_conv_kernel"] // 2,
      )
  
      self.word_state_weight = nn.Linear(
          self.hidden_size, self.hidden_size
      )
      self.word_embedding_weight = nn.Linear(
          self.input_size, self.hidden_size
      )
      self.word_context_weight = nn.Linear(
          self.out_channel, self.hidden_size
      )
      self.counting_context_weight = nn.Linear(
          self.counting_num, self.hidden_size
      )
      self.word_convert = nn.Linear(self.hidden_size, self.word_num)
  
      if dropout:
          self.dropout = nn.Dropout(dropout_ratio)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import paddle.nn
  import paddle
  import math
label_desc: Use image node_id 1 to create a new AttDecoder object from inherited base classes: nn with example: obj = AttDecoder(ratio, is_train, input_size, hidden_size, encoder_out_channel, dropout, dropout_ratio, word_num, counting_decoder_out_channel, attention)