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 state_to_tensor(self):
      # Slightly hacky way to implement this in a curried manner
      # (so that the function can be extracted from an instance)
      # Somewhat more sound may be to turn this into a
      # @staticmethod and grab subclasses using hydra.utils.get_class
      def fn(state):
          x = [
              _layer.state_to_tensor(_state)
              for (_layer, _state) in zip(self.layers, state)
          ]
          x = [_x for _x in x if _x is not None]
          return torch.cat(x, dim=-1)
  
      return fn
  
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 4 for calling the SequenceModel obj's underlying member method code with example usage: obj.state_to_tensor() and returns: fn, torch