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 call(self, inputs, training=None, mask=None):
      dec_emb_fn = lambda ids: self.embed(ids)
      if self.is_infer:
          enc_outputs, enc_state, enc_seq_len = inputs
          batch_size = tf.shape(enc_outputs)[0]
          helper = seq2seq.GreedyEmbeddingHelper(
              embedding=dec_emb_fn,
              start_tokens=tf.fill([batch_size], self.dec_start_id),
              end_token=self.dec_end_id,
          )
      else:
          (
              dec_inputs,
              dec_seq_len,
              enc_outputs,
              enc_state,
              enc_seq_len,
          ) = inputs
          batch_size = tf.shape(enc_outputs)[0]
          dec_inputs = self.embed(dec_inputs)
          helper = seq2seq.TrainingHelper(
              inputs=dec_inputs, sequence_length=dec_seq_len
          )
  
      if self.is_infer and self.beam_size > 1:
          tiled_enc_outputs = seq2seq.tile_batch(
              enc_outputs, multiplier=self.beam_size
          )
          tiled_seq_len = seq2seq.tile_batch(
              enc_seq_len, multiplier=self.beam_size
          )
          attn_mech = self._build_attention(
              enc_outputs=tiled_enc_outputs, enc_seq_len=tiled_seq_len
          )
          dec_cell = seq2seq.AttentionWrapper(self.cell, attn_mech)
          tiled_enc_last_state = seq2seq.tile_batch(
              enc_state, multiplier=self.beam_size
          )
          tiled_dec_init_state = dec_cell.zero_state(
              batch_size=batch_size * self.beam_size, dtype=tf.float32
          )
          if self.initial_decode_state:
              tiled_dec_init_state = tiled_dec_init_state.clone(
                  cell_state=tiled_enc_last_state
              )
  
          dec = seq2seq.BeamSearchDecoder(
              cell=dec_cell,
              embedding=dec_emb_fn,
              start_tokens=tf.tile([self.dec_start_id], [batch_size]),
              end_token=self.dec_end_id,
              initial_state=tiled_dec_init_state,
              beam_width=self.beam_size,
              output_layer=tf.layers.Dense(self.vocab_size),
              length_penalty_weight=self.length_penalty,
          )
      else:
          attn_mech = self._build_attention(
              enc_outputs=enc_outputs, enc_seq_len=enc_seq_len
          )
          dec_cell = seq2seq.AttentionWrapper(
              cell=self.cell, attention_mechanism=attn_mech
          )
          dec_init_state = dec_cell.zero_state(
              batch_size=batch_size, dtype=tf.float32
          )
          if self.initial_decode_state:
              dec_init_state = dec_init_state.clone(
                  cell_state=enc_state
              )
          dec = seq2seq.BasicDecoder(
              cell=dec_cell,
              helper=helper,
              initial_state=dec_init_state,
              output_layer=tf.layers.Dense(self.vocab_size),
          )
      if self.is_infer:
          dec_outputs, _, _ = seq2seq.dynamic_decode(
              decoder=dec,
              maximum_iterations=self.max_dec_len,
              swap_memory=self.swap_memory,
              output_time_major=self.time_major,
          )
          return dec_outputs.predicted_ids[:, :, 0]
      else:
          dec_outputs, _, _ = seq2seq.dynamic_decode(
              decoder=dec,
              maximum_iterations=tf.reduce_max(dec_seq_len),
              swap_memory=self.swap_memory,
              output_time_major=self.time_major,
          )
      return dec_outputs.rnn_output
  
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 3 for calling the RnnDecoder obj's underlying member method code with example usage: obj.call(inputs, training, mask) and returns: dec_outputs, dec_outputs