docstr: Initialize the states required for incremental decoding
  
  Parameters
  ----------
  src_data
      - layout = 'NT'
          Shape (batch_size, src_length)
      - layout = 'TN'
          Shape (src_length, batch_size)
  
  src_valid_length
      Shape (batch_size,)
  
  Returns
  -------
  enc_out
      - layout = 'NT'
          Shape (batch_size, src_length, C_mem)
      - layout = 'TN'
          Shape (src_length, batch_size, C_mem)
  
  src_valid_length
      Shape (batch_size,)
  position
      Shape (batch_size,)
  dec_states: list
      The states of the decoder
docstr_tok: ["Initialize","the","states","required","for","incremental","decoding","Parameters","--","--","--","--","--","src_data","-","layout","=","'NT'","Shape","(","batch_size",",","src_length",")","-","layout","=","'TN'","Shape","(","src_length",",","batch_size",")","src_valid_length","Shape","(","batch_size",",",")","Returns","--","--","--","-","enc_out","-","layout","=","'NT'","Shape","(","batch_size",",","src_length",",","C_mem",")","-","layout","=","'TN'","Shape","(","src_length",",","batch_size",",","C_mem",")","src_valid_length","Shape","(","batch_size",",",")","position","Shape","(","batch_size",",",")","dec_states",":","list","The","states","of","the","decoder"]
code: def init_states(
      self, src_data, src_valid_length
  ):  # TODO(sxjscience) Revisit here, support auxiliary states?
      """Initialize the states required for incremental decoding
  
      Parameters
      ----------
      src_data
          - layout = 'NT'
              Shape (batch_size, src_length)
          - layout = 'TN'
              Shape (src_length, batch_size)
  
      src_valid_length
          Shape (batch_size,)
  
      Returns
      -------
      enc_out
          - layout = 'NT'
              Shape (batch_size, src_length, C_mem)
          - layout = 'TN'
              Shape (src_length, batch_size, C_mem)
  
      src_valid_length
          Shape (batch_size,)
      position
          Shape (batch_size,)
      dec_states: list
          The states of the decoder
      """
      if self.model.layout == "NT":
          batch_size = src_data.shape[0]
      else:
          batch_size = src_data.shape[1]
      ctx = src_data.ctx
      enc_out = self.model.encode(src_data, src_valid_length)
      position = mx.np.zeros((batch_size,), dtype=np.int32, ctx=ctx)
      dtype = enc_out.dtype
      dec_states = self.model.decoder.init_states(
          batch_size, ctx, dtype
      )
      return enc_out, src_valid_length, position, dec_states
  
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 4 for calling the TransformerInference obj's underlying member method code with example usage: obj.init_states(src_data, src_valid_length) and returns: enc_out,  src_valid_length,  position,  dec_states