docstr: Initialize the states required for incremental decoding
  
  Returns
  -------
  states
      A list of states, each includes:
  
          - init_key
              - layout = 'NT'
                  Shape (batch_size, 0, N, C_key)
              - layout = 'TN'
                  Shape (0, batch_size, N, C_key)
  
          - init_value :
              - layout = 'NT'
                  Shape (batch_size, 0, N, C_value)
              - layout = 'TN'
                  Shape (0, batch_size, N, C_value)
docstr_tok: ["Initialize","the","states","required","for","incremental","decoding","Returns","--","--","--","-","states","A","list","of","states",",","each","includes",":","-","init_key","-","layout","=","'NT'","Shape","(","batch_size",",","0",",","N",",","C_key",")","-","layout","=","'TN'","Shape","(","0",",","batch_size",",","N",",","C_key",")","-","init_value",":","-","layout","=","'NT'","Shape","(","batch_size",",","0",",","N",",","C_value",")","-","layout","=","'TN'","Shape","(","0",",","batch_size",",","N",",","C_value",")"]
code: def init_states(self, batch_size, ctx, dtype="float32"):
      """Initialize the states required for incremental decoding
  
      Returns
      -------
      states
          A list of states, each includes:
  
              - init_key
                  - layout = 'NT'
                      Shape (batch_size, 0, N, C_key)
                  - layout = 'TN'
                      Shape (0, batch_size, N, C_key)
  
              - init_value :
                  - layout = 'NT'
                      Shape (batch_size, 0, N, C_value)
                  - layout = 'TN'
                      Shape (0, batch_size, N, C_value)
  
      """
      states = []
      for i in range(self.num_layers):
          if self.recurrent:
              layer = self.layers[0]
          else:
              layer = self.layers[i]
          states.append(
              layer.init_states(
                  batch_size=batch_size, ctx=ctx, dtype=dtype
              )
          )
      return 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 5 for calling the TransformerDecoder obj's underlying member method code with example usage: obj.init_states(batch_size, ctx, dtype) and returns: states