class_docstr: Transformer-based Speech-to-Text Decoder from OpenAI's Whisper Model:
  
  URL: https://github.com/openai/whisper
class_docstr_tok: ["Transformer-based","Speech-to-Text","Decoder","from","OpenAI","'s","Whisper","Model",":","URL",":","https",":","\/\/github.com\/openai\/whisper"]
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,
  ) -> 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, )
      """
      tgt, memory = ys_in_pad, hs_pad
      tgt = (
          self.decoders.token_embedding(tgt)
          + self.decoders.positional_embedding[: tgt.size(1)]
      )
      tgt = self.dropout(tgt)
  
      x = tgt.to(memory.dtype)
  
      for layer, block in enumerate(self.decoders.blocks):
          x = block(x, memory, mask=self.decoders.mask)
          if layer < len(self.decoders.blocks) - 1:
              x = self.dropout(x)
  
      x = self.decoders.ln(x)
      x = (
          x
          @ torch.transpose(
              self.decoders.token_embedding.weight.to(x.dtype), 0, 1
          )
      ).float()
  
      return x, ys_in_lens
  
file_path: espnet/espnet2/asr/decoder/whisper_decoder.py
imports: import copy
  from typing import Any, List, Tuple
  import torch
  from typeguard import check_argument_types
  from espnet2.asr.decoder.abs_decoder import AbsDecoder
  from espnet.nets.scorer_interface import BatchScorerInterface
label_desc: Use image node_id 2 for calling the OpenAIWhisperDecoder obj's underlying member method code with example usage: obj.forward(hs_pad, hlens, ys_in_pad, ys_in_lens) and returns: x,  ys_in_lens