docstr: Initialize the states required for incremental decoding
  
  Parameters
  ----------
  batch_size
  device
  dtype
  
  Returns
  -------
  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","Parameters","--","--","--","--","--","batch_size","device","dtype","Returns","--","--","--","-","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, device=None, dtype="float32"):
      """Initialize the states required for incremental decoding
  
      Parameters
      ----------
      batch_size
      device
      dtype
  
      Returns
      -------
      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)
      """
      dtype = to_torch_dtype(dtype)
      if self.layout == "NT":
          init_key = th.zeros(
              size=(
                  batch_size,
                  0,
                  self._num_heads,
                  self._units // self._num_heads,
              ),
              device=device,
              dtype=dtype,
          )
          init_value = th.zeros(
              size=(
                  batch_size,
                  0,
                  self._num_heads,
                  self._units // self._num_heads,
              ),
              device=device,
              dtype=dtype,
          )
      else:
          init_key = th.zeros(
              size=(
                  0,
                  batch_size,
                  self._num_heads,
                  self._units // self._num_heads,
              ),
              device=device,
              dtype=dtype,
          )
          init_value = th.zeros(
              size=(
                  0,
                  batch_size,
                  self._num_heads,
                  self._units // self._num_heads,
              ),
              device=device,
              dtype=dtype,
          )
      return init_key, init_value
  
imports: from typing import Union, Optional, List
  from torch import nn
  import torch
  from ..layers import PositionwiseFFN
  from ..attention_cell import MultiHeadAttentionCell, gen_mem_attn_mask, gen_self_attn_mask
  from ..utils import to_torch_dtype
label_desc: Use image node_id 7 for calling the TransformerDecoderLayer obj's underlying member method code with example usage: obj.init_states(batch_size, device, dtype) and returns: init_key,  init_value