class_docstr: Transformer-based Speech Encoder from OpenAI's Whisper Model:
  
  URL: https://github.com/openai/whisper
class_docstr_tok: ["Transformer-based","Speech","Encoder","from","OpenAI","'s","Whisper","Model",":","URL",":","https",":","\/\/github.com\/openai\/whisper"]
code: def forward(
      self,
      xs_pad: torch.Tensor,
      ilens: torch.Tensor,
      prev_states: torch.Tensor = None,
  ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]:
      if self.do_pad_trim:
          xs_pad = self.pad_or_trim(xs_pad, self.pad_samples)
  
      feats, feats_lens = self.log_mel_spectrogram(xs_pad, ilens)
  
      if self.specaug is not None and self.encoders.training:
          feats = torch.transpose(feats, 1, 2)
          feats, feats_lens = self.specaug(feats, feats_lens)
          feats = torch.transpose(feats, 1, 2)
  
      xs_pad, olens = self.whisper_encode(feats, feats_lens)
  
      return xs_pad, olens, None
  
file_path: espnet/espnet2/asr/encoder/whisper_encoder.py
imports: import copy
  from typing import Optional, Tuple, Union
  import torch
  import torch.nn.functional
  from typeguard import check_argument_types
  from espnet2.asr.encoder.abs_encoder import AbsEncoder
  from espnet2.asr.specaug.specaug import SpecAug
label_desc: Use image node_id 6 for calling the OpenAIWhisperEncoder obj's underlying member method code with example usage: obj.forward(xs_pad, ilens, prev_states) and returns: xs_pad,  olens,  None