class_docstr: Abstract sequence model class.
  
  All models must adhere to this interface
  
  A SequenceModule is generally a model that transforms an input of shape
  (n_batch, l_sequence, d_model) to (n_batch, l_sequence, d_output)
  
  REQUIRED methods and attributes
  forward, d_model, d_output: controls standard forward pass,
  a sequence-to-sequence transformation
  __init__ should also satisfy the following interface;
  see SequenceIdentity for an example
      def __init__(self, d_model, transposed=False, **kwargs)
  
  OPTIONAL methods
  default_state, step: allows stepping the model recurrently with a hidden state
  state_to_tensor, d_state: allows decoding from hidden state
class_docstr_tok: ["Abstract","sequence","model","class",".","All","models","must","adhere","to","this","interface","A","SequenceModule","is","generally","a","model","that","transforms","an","input","of","shape","(","n_batch",",","l_sequence",",","d_model",")","to","(","n_batch",",","l_sequence",",","d_output",")","REQUIRED","methods","and","attributes","forward",",","d_model",",","d_output",":","controls","standard","forward","pass",",","a","sequence-to-sequence","transformation","__init__","should","also","satisfy","the","following","interface",";","see","SequenceIdentity","for","an","example","def","__init__","(","self",",","d_model",",","transposed=False",",","*","*","kwargs",")","OPTIONAL","methods","default_state",",","step",":","allows","stepping","the","model","recurrently","with","a","hidden","state","state_to_tensor",",","d_state",":","allows","decoding","from","hidden","state"]
docstr: Forward pass.
  
  A sequence-to-sequence transformation with an optional state.
  
  Generally, this should map a tensor of shape
  (batch, length, self.d_model) to (batch, length, self.d_output)
  
  Additionally, it returns a "state" which can be any additional information
  For example, RNN and SSM layers may return their hidden state,
  while some types of transformer layers
  (e.g. Transformer-XL) may want to pass a state as well
docstr_tok: ["Forward","pass",".","A","sequence-to-sequence","transformation","with","an","optional","state",".","Generally",",","this","should","map","a","tensor","of","shape","(","batch",",","length",",","self.d_model",")","to","(","batch",",","length",",","self.d_output",")","Additionally",",","it","returns","a","``","state","''","which","can","be","any","additional","information","For","example",",","RNN","and","SSM","layers","may","return","their","hidden","state",",","while","some","types","of","transformer","layers","(","e.g",".","Transformer-XL",")","may","want","to","pass","a","state","as","well"]
code: def forward(self, x, state=None, **kwargs):
      """Forward pass.
  
      A sequence-to-sequence transformation with an optional state.
  
      Generally, this should map a tensor of shape
      (batch, length, self.d_model) to (batch, length, self.d_output)
  
      Additionally, it returns a "state" which can be any additional information
      For example, RNN and SSM layers may return their hidden state,
      while some types of transformer layers
      (e.g. Transformer-XL) may want to pass a state as well
      """
      return x, None
  
file_path: espnet/espnet2/asr/state_spaces/base.py
imports: import functools
  from torch import nn
label_desc: Use image node_id 5 for calling the SequenceModule obj's underlying member method code with example usage: obj.forward(x, state) and returns: x,  None