class_docstr: Transformer Encoder is stacked with several
  TransformerdecLayers, consist of beamsearch for infrence.
class_docstr_tok: ["Transformer","Encoder","is","stacked","with","several","TransformerdecLayers",",","consist","of","beamsearch","for","infrence","."]
code: def call(self, inps, training=None, mask=None):
      if not self.is_infer:
          dec_inp, enc_out = inps
          with tf.name_scope("while"):
              dec_out = self.decode(dec_inp, enc_out, training, mask)
              scores = self.final_dense(dec_out)
              return scores
      else:
          enc_out = inps
          init_ids = tf.cast(
              tf.ones([utils.shape_list(enc_out)[0]]) * self.sos_id,
              tf.int32,
          )
          # Beam Search
          enc_shape = utils.shape_list(enc_out)
          enc_out = tf.tile(
              tf.expand_dims(enc_out, axis=1), [1, self.beam_size, 1, 1]
          )
          enc_out = tf.reshape(
              enc_out,
              [
                  enc_shape[0] * self.beam_size,
                  enc_shape[1],
                  enc_shape[2],
              ],
          )
          enc_mask = tf.tile(
              tf.expand_dims(mask, axis=1), [1, self.beam_size, 1, 1, 1]
          )
          enc_mask = tf.reshape(
              enc_mask, [enc_shape[0] * self.beam_size, 1, 1, -1]
          )
  
          def symbols_to_logits_fn(dec_inps):
              dec_out = self.decode(
                  dec_inps, enc_out, training, enc_mask
              )
              scores = self.final_dense(dec_out)
              return scores[:, -1, :]
  
          decoded_ids, scores, _ = self.beam_search(
              symbols_to_logits_fn,
              init_ids,
              self.beam_size,
              self.max_dec_len,
              self.vocab_size,
              self.length_penalty,
              self.eos_id,
          )
          decoded_ids = decoded_ids[:, 0, 1:]
  
          return decoded_ids
  
imports: import math
  from absl import logging
  import numpy
  import delta.compat
  from tensorflow.python.util import nest
  from delta.layers.base_layer import Layer
  from delta.layers import utils_tf
  import delta.layers
label_desc: Use image node_id 3 for calling the TransformerDecoder obj's underlying member method code with example usage: obj.call(inps, training, mask) and returns: decoded_ids, scores, scores