class_docstr: S4 decoder module.
  
  Args:
      vocab_size: output dim
      encoder_output_size: dimension of hidden vector
      input_layer: input layer type
      dropinp: input dropout
      dropout: dropout parameter applied on every residual and every layer
      prenorm: pre-norm vs. post-norm
      n_layers: number of layers
      transposed: transpose inputs so each layer receives (batch, dim, length)
      tie_dropout: tie dropout mask across sequence like nn.Dropout1d/nn.Dropout2d
      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
      drop_path: drop rate for stochastic depth
class_docstr_tok: ["S4","decoder","module",".","Args",":","vocab_size",":","output","dim","encoder_output_size",":","dimension","of","hidden","vector","input_layer",":","input","layer","type","dropinp",":","input","dropout","dropout",":","dropout","parameter","applied","on","every","residual","and","every","layer","prenorm",":","pre-norm","vs.","post-norm","n_layers",":","number","of","layers","transposed",":","transpose","inputs","so","each","layer","receives","(","batch",",","dim",",","length",")","tie_dropout",":","tie","dropout","mask","across","sequence","like","nn.Dropout1d\/nn.Dropout2d","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","drop_path",":","drop","rate","for","stochastic","depth"]
docstr: Forward decoder.
  
  Args:
      hs_pad: encoded memory, float32  (batch, maxlen_in, feat)
      hlens: (batch)
      ys_in_pad:
          input token ids, int64 (batch, maxlen_out)
          if input_layer == "embed"
          input tensor (batch, maxlen_out, #mels) in the other cases
      ys_in_lens: (batch)
  Returns:
      (tuple): tuple containing:
  
      x: decoded token score before softmax (batch, maxlen_out, token)
          if use_output_layer is True,
      olens: (batch, )
docstr_tok: ["Forward","decoder",".","Args",":","hs_pad",":","encoded","memory",",","float32","(","batch",",","maxlen_in",",","feat",")","hlens",":","(","batch",")","ys_in_pad",":","input","token","ids",",","int64","(","batch",",","maxlen_out",")","if","input_layer","==","``","embed","''","input","tensor","(","batch",",","maxlen_out",",","#","mels",")","in","the","other","cases","ys_in_lens",":","(","batch",")","Returns",":","(","tuple",")",":","tuple","containing",":","x",":","decoded","token","score","before","softmax","(","batch",",","maxlen_out",",","token",")","if","use_output_layer","is","True",",","olens",":","(","batch",",",")"]
code: def forward(
      self,
      hs_pad: torch.Tensor,
      hlens: torch.Tensor,
      ys_in_pad: torch.Tensor,
      ys_in_lens: torch.Tensor,
      state=None,
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      """Forward decoder.
  
      Args:
          hs_pad: encoded memory, float32  (batch, maxlen_in, feat)
          hlens: (batch)
          ys_in_pad:
              input token ids, int64 (batch, maxlen_out)
              if input_layer == "embed"
              input tensor (batch, maxlen_out, #mels) in the other cases
          ys_in_lens: (batch)
      Returns:
          (tuple): tuple containing:
  
          x: decoded token score before softmax (batch, maxlen_out, token)
              if use_output_layer is True,
          olens: (batch, )
      """
      memory = hs_pad
      memory_mask = (~make_pad_mask(hlens, maxlen=memory.size(1)))[
          :, None, :
      ].to(memory.device)
  
      emb = self.embed(ys_in_pad)
      z, state = self.decoder(
          emb,
          state=state,
          memory=memory,
          lengths=ys_in_lens,
          mask=memory_mask,
      )
  
      decoded = self.output(z)
      return decoded, ys_in_lens
  
file_path: espnet/espnet2/asr/decoder/s4_decoder.py
imports: from typing import Any, List, Tuple
  import torch
  from typeguard import check_argument_types
  from espnet2.asr.decoder.abs_decoder import AbsDecoder
  from espnet2.asr.state_spaces.model import SequenceModel
  from espnet.nets.pytorch_backend.nets_utils import make_pad_mask
  from espnet.nets.scorer_interface import BatchScorerInterface
label_desc: Use image node_id 3 for calling the S4Decoder obj's underlying member method code with example usage: obj.forward(hs_pad, hlens, ys_in_pad, ys_in_lens, state) and returns: decoded,  ys_in_lens