docstr: Decode a sequence of inputs
  
  Parameters
  ----------
  tgt_data
      - layout = 'NT'
          Shape (batch_size, tgt_length)
      - layout = 'TN'
          Shape (tgt_length, batch_size)
  
  tgt_valid_length
      Shape (batch_size,)
  mem_data
      - layout = 'NT'
          Shape (batch_size, src_length, C_out)
      - layout = 'TN'
          Shape (src_length, batch_size, C_out)
  
  mem_valid_length :
      Shape (batch_size,)
  
  Returns
  -------
  dec_out
      - layout = 'NT'
          Shape (batch_size, tgt_length, tgt_vocab_size)
      - layout = 'TN'
          Shape (tgt_length, batch_size, tgt_vocab_size)
docstr_tok: ["Decode","a","sequence","of","inputs","Parameters","--","--","--","--","--","tgt_data","-","layout","=","'NT'","Shape","(","batch_size",",","tgt_length",")","-","layout","=","'TN'","Shape","(","tgt_length",",","batch_size",")","tgt_valid_length","Shape","(","batch_size",",",")","mem_data","-","layout","=","'NT'","Shape","(","batch_size",",","src_length",",","C_out",")","-","layout","=","'TN'","Shape","(","src_length",",","batch_size",",","C_out",")","mem_valid_length",":","Shape","(","batch_size",",",")","Returns","--","--","--","-","dec_out","-","layout","=","'NT'","Shape","(","batch_size",",","tgt_length",",","tgt_vocab_size",")","-","layout","=","'TN'","Shape","(","tgt_length",",","batch_size",",","tgt_vocab_size",")"]
code: def decode_seq(
      self, tgt_data, tgt_valid_length, mem_data, mem_valid_length
  ):
      """Decode a sequence of inputs
  
      Parameters
      ----------
      tgt_data
          - layout = 'NT'
              Shape (batch_size, tgt_length)
          - layout = 'TN'
              Shape (tgt_length, batch_size)
  
      tgt_valid_length
          Shape (batch_size,)
      mem_data
          - layout = 'NT'
              Shape (batch_size, src_length, C_out)
          - layout = 'TN'
              Shape (src_length, batch_size, C_out)
  
      mem_valid_length :
          Shape (batch_size,)
  
      Returns
      -------
      dec_out
          - layout = 'NT'
              Shape (batch_size, tgt_length, tgt_vocab_size)
          - layout = 'TN'
              Shape (tgt_length, batch_size, tgt_vocab_size)
  
      """
      tgt_data = self.tgt_embed_layer(tgt_data)
      if self.scaled_embed:
          tgt_data = tgt_data * _np.sqrt(self.dec_units)
      if self.pos_embed_type is not None:
          if self.layout == "NT":
              tgt_data = tgt_data + self.tgt_pos_embed_layer(
                  npx.arange_like(tgt_data, axis=1)
              )
          else:
              tgt_data = tgt_data + np.expand_dims(
                  self.tgt_pos_embed_layer(
                      npx.arange_like(tgt_data, axis=0)
                  ),
                  axis=1,
              )
  
      dec_out = self.decoder(
          tgt_data, tgt_valid_length, mem_data, mem_valid_length
      )
      return dec_out
  
imports: import numpy
  import mxnet
  from mxnet import np, npx
  from mxnet import use_np
  from mxnet.gluon import nn, HybridBlock
  from typing import Optional, Tuple, List
  from ..utils.registry import Registry
  from ..attention_cell import MultiHeadAttentionCell, gen_self_attn_mask, gen_mem_attn_mask
  from ..layers import PositionalEmbedding, PositionwiseFFN, InitializerType
  from ..utils.config import CfgNode
  from ..sequence_sampler import BaseStepDecoder
label_desc: Use image node_id 6 for calling the TransformerModel obj's underlying member method code with example usage: obj.decode_seq(tgt_data, tgt_valid_length, mem_data, mem_valid_length) and returns: dec_out