class_docstr: Wrapper around SSKernel parameterizations.
  
  The SSKernel is expected to support the interface
  forward()
  default_state()
  _setup_step()
  step()
class_docstr_tok: ["Wrapper","around","SSKernel","parameterizations",".","The","SSKernel","is","expected","to","support","the","interface","forward","(",")","default_state","(",")","_setup_step","(",")","step","(",")"]
docstr: Forward the state through a sequence.
  
  i.e. computes the state after passing chunk through SSM
  
  state: (B, H, N)
  u: (B, H, L)
  
  Returns: (B, H, N)
docstr_tok: ["Forward","the","state","through","a","sequence",".","i.e",".","computes","the","state","after","passing","chunk","through","SSM","state",":","(","B",",","H",",","N",")","u",":","(","B",",","H",",","L",")","Returns",":","(","B",",","H",",","N",")"]
code: def forward_state(self, u, state):
      """Forward the state through a sequence.
  
      i.e. computes the state after passing chunk through SSM
  
      state: (B, H, N)
      u: (B, H, L)
  
      Returns: (B, H, N)
      """
      if hasattr(self.kernel, "forward_state"):
          return self.kernel.forward_state(u, state)
  
      dA, dB = self.kernel._setup_state()  # Construct dA, dB matrices
      # dA, dB = self.kernel.dA, self.kernel.dB # (H N N) (H N)
  
      conj = state.size(-1) != dA.size(-1)
      if conj:
          state = _conj(state)
  
      v = contract(
          "h n, b h l -> b h n l", dB, u.flip(-1)
      )  # dB.unsqueeze(-1) * u.flip(-1).unsqueeze(-2)
      AL, v = power(u.size(-1), dA, v)
      next_state = contract("h m n, b h n -> b h m", AL, state)
      next_state = next_state + v
  
      if conj:
          next_state = next_state[..., : next_state.size(-1) // 2]
      return next_state
  
imports: import logging
  import math
  import os
  from functools import wraps
  from typing import Any, Callable, Optional
  import numpy
  import opt_einsum
  import torch
  import torch.nn
  import torch.nn.functional
  from einops import rearrange, repeat
  from espnet2.asr.state_spaces.components import Activation, DropoutNd, LinearActivation
label_desc: Use image node_id 3 for calling the SSKernel obj's underlying member method code with example usage: obj.forward_state(u, state) and returns: next_state, self