class_docstr: RNN + Attention
  Input Shape: [batch_size, steps, features]
  Output Shape: [batch_size, units]
class_docstr_tok: ["RNN","+","Attention","Input","Shape",":","[","batch_size",",","steps",",","features","]","Output","Shape",":","[","batch_size",",","units","]"]
code: def __init__(self, config, emb_layer, vocab_size, **kwargs):
      super().__init__(**kwargs)
      logging.info("Initialize RnnDecoder {}...".format(self.name))
      self.is_infer = config["model"]["is_infer"]
      model_config = config["model"]["net"]["structure"]
      self.dropout_rate = model_config["dropout_rate"]
      self.cell_dim = model_config["cell_dim"]
      self.decode_cell_type = model_config["decode_cell_type"]
      self.max_dec_len = model_config["max_dec_len"]
      self.dec_end_id = 5
      self.dec_start_id = 4
      self.beam_size = model_config["beam_size"]
      self.length_penalty = model_config["length_penalty"]
      self.swap_memory = model_config["swap_memory"]
      self.time_major = model_config["time_major"]
      self.initial_decode_state = model_config["initial_decode_state"]
      self.attn_Type = model_config["attn_Type"]
      if self.decode_cell_type.lower() == "gru":
          rnn_class = tf.nn.rnn_cell.GRUCell
      elif self.decode_cell_type.lower() == "lstm":
          rnn_class = tf.nn.rnn_cell.LSTMCell
      else:
          error_info = (
              "Cell type: {} not supported now! Please check!".format(
                  self.decode_cell_type
              )
          )
          logging.error(error_info)
          raise ValueError(error_info)
  
      self.cell = rnn_class(2 * self.cell_dim)
      self.embed = emb_layer
      self.vocab_size = vocab_size
      self.embed_d = tf.keras.layers.Dropout(self.dropout_rate)
  
imports: from absl import logging
  import delta.compat
  import delta
  from delta.layers.base_layer import Layer
  from tensorflow_addons import seq2seq
label_desc: Use image node_id 1 to create a new RnnDecoder object from inherited base classes: Layer with example: obj = RnnDecoder(config, emb_layer, vocab_size)