class_docstr: Custom long-short-term memory (LSTM) block that applies layer normalization
  to internal nodes.
  
  Args:
      input_dim (int): input dimension.
      hidden_dim (int): hidden dimension.
      layer_norm (bool, optional): if ``True``, enables layer normalization. (Default: ``False``)
      layer_norm_epsilon (float, optional):  value of epsilon to use in
          layer normalization layers (Default: 1e-5)
class_docstr_tok: ["Custom","long-short-term","memory","(","LSTM",")","block","that","applies","layer","normalization","to","internal","nodes",".","Args",":","input_dim","(","int",")",":","input","dimension",".","hidden_dim","(","int",")",":","hidden","dimension",".","layer_norm","(","bool",",","optional",")",":","if","``","True","``",",","enables","layer","normalization",".","(","Default",":","``","False","``",")","layer_norm_epsilon","(","float",",","optional",")",":","value","of","epsilon","to","use","in","layer","normalization","layers","(","Default",":","1e-5",")"]
docstr: Forward pass.
  
  B: batch size;
  T: maximum sequence length in batch;
  D: feature dimension of each input sequence element.
  
  Args:
      input (torch.Tensor): with shape `(T, B, D)`.
      state (List[torch.Tensor] or None): list of tensors
          representing internal state generated in preceding invocation
          of ``forward``.
  
  Returns:
      (torch.Tensor, List[torch.Tensor]):
          torch.Tensor
              output, with shape `(T, B, hidden_dim)`.
          List[torch.Tensor]
              list of tensors representing internal state generated
              in current invocation of ``forward``.
docstr_tok: ["Forward","pass",".","B",":","batch","size",";","T",":","maximum","sequence","length","in","batch",";","D",":","feature","dimension","of","each","input","sequence","element",".","Args",":","input","(","torch.Tensor",")",":","with","shape","`","(","T",",","B",",","D",")","`",".","state","(","List","[","torch.Tensor","]","or","None",")",":","list","of","tensors","representing","internal","state","generated","in","preceding","invocation","of","``","forward","``",".","Returns",":","(","torch.Tensor",",","List","[","torch.Tensor","]",")",":","torch.Tensor","output",",","with","shape","`","(","T",",","B",",","hidden_dim",")","`",".","List","[","torch.Tensor","]","list","of","tensors","representing","internal","state","generated","in","current","invocation","of","``","forward","``","."]
code: def forward(
      self, input: torch.Tensor, state: Optional[List[torch.Tensor]]
  ) -> Tuple[torch.Tensor, List[torch.Tensor]]:
      r"""Forward pass.
  
      B: batch size;
      T: maximum sequence length in batch;
      D: feature dimension of each input sequence element.
  
      Args:
          input (torch.Tensor): with shape `(T, B, D)`.
          state (List[torch.Tensor] or None): list of tensors
              representing internal state generated in preceding invocation
              of ``forward``.
  
      Returns:
          (torch.Tensor, List[torch.Tensor]):
              torch.Tensor
                  output, with shape `(T, B, hidden_dim)`.
              List[torch.Tensor]
                  list of tensors representing internal state generated
                  in current invocation of ``forward``.
      """
      if state is None:
          B = input.size(1)
          h = torch.zeros(
              B, self.hidden_dim, device=input.device, dtype=input.dtype
          )
          c = torch.zeros(
              B, self.hidden_dim, device=input.device, dtype=input.dtype
          )
      else:
          h, c = state
  
      gated_input = self.x2g(input)
      outputs = []
      for gates in gated_input.unbind(0):
          gates = gates + self.p2g(h)
          gates = self.g_norm(gates)
          input_gate, forget_gate, cell_gate, output_gate = gates.chunk(
              4, 1
          )
          input_gate = input_gate.sigmoid()
          forget_gate = forget_gate.sigmoid()
          cell_gate = cell_gate.tanh()
          output_gate = output_gate.sigmoid()
          c = forget_gate * c + input_gate * cell_gate
          c = self.c_norm(c)
          h = output_gate * c.tanh()
          outputs.append(h)
  
      output = torch.stack(outputs, dim=0)
      state = [h, c]
  
      return output, state
  
imports: from abc import ABC, abstractmethod
  from typing import List, Optional, Tuple
  import torch
  from torchaudio.models import Emformer
label_desc: Use image node_id 2 for calling the _CustomLSTM obj's underlying member method code with example usage: obj.forward(input, state) and returns: output,  state