class_docstr: Isotropic deep sequence model backbone, in the style of ResNets / Transformers.
  
  The SequenceModel class implements a generic
  (batch, length, d_input) -> (batch, length, d_output) transformation
  
  Args:
      d_model: Resize input (useful for deep models with residuals)
      n_layers: Number of layers
      transposed: Transpose inputs so each layer receives (batch, dim, length)
      dropout: Dropout parameter applied on every residual and every layer
      tie_dropout: Tie dropout mask across sequence like nn.Dropout1d/nn.Dropout2d
      prenorm: Pre-norm vs. post-norm
      n_repeat: Each layer is repeated n times per stage before applying pooling
      layer: Layer config, must be specified
      residual: Residual config
      norm: Normalization config (e.g. layer vs batch)
      pool: Config for pooling layer per stage
      track_norms: Log norms of each layer output
      dropinp: Input dropout
      drop_path: Stochastic depth for each residual path
code: def forward(self, inputs, *args, state=None, **kwargs):
      # Inputs assumed to be (batch, sequence, dim)
      if self.transposed:
          inputs = rearrange(inputs, "b ... d -> b d ...")
      inputs = self.drop(inputs)
  
      # Track norms
      if self.track_norms:
          output_norms = [torch.mean(inputs.detach() ** 2)]
  
      # Apply layers
      outputs = inputs
      prev_states = (
          [None] * len(self.layers) if state is None else state
      )
      next_states = []
      for layer, prev_state in zip(self.layers, prev_states):
          outputs, state = layer(
              outputs, *args, state=prev_state, **kwargs
          )
          next_states.append(state)
          if self.track_norms:
              output_norms.append(torch.mean(outputs.detach() ** 2))
      if self.norm is not None:
          outputs = self.norm(outputs)
  
      if self.transposed:
          outputs = rearrange(outputs, "b d ... -> b ... d")
  
      if self.track_norms:
          metrics = to_dict(output_norms, recursive=False)
          self.metrics = {f"norm/{i}": v for i, v in metrics.items()}
  
      return outputs, next_states
  
file_path: espnet/espnet2/asr/state_spaces/model.py
imports: from functools import partial
  import torch
  import torch.nn
  from einops import rearrange
  from espnet2.asr.state_spaces.base import SequenceModule
  from espnet2.asr.state_spaces.block import SequenceResidualBlock
  from espnet2.asr.state_spaces.components import DropoutNd, Normalization
  from espnet2.asr.state_spaces.utils import to_dict, to_list
label_desc: Use image node_id 2 for calling the SequenceModel obj's underlying member method code with example usage: obj.forward(inputs) and returns: outputs,  next_states