class_docstr: Extract features from log-mel spectrogram input. Consists of linear layer and time reduction layer.
  
  Args:
      input_dim (int): The feature dimension of log-mel spectrogram feature.
      output_dim (int): The feature dimension after linear layer.
      use_bias (bool): If ``True``, enable bias parameter in the linear layer.
      stride (int): Number of frames to merge for the output frame.
class_docstr_tok: ["Extract","features","from","log-mel","spectrogram","input",".","Consists","of","linear","layer","and","time","reduction","layer",".","Args",":","input_dim","(","int",")",":","The","feature","dimension","of","log-mel","spectrogram","feature",".","output_dim","(","int",")",":","The","feature","dimension","after","linear","layer",".","use_bias","(","bool",")",":","If","``","True","``",",","enable","bias","parameter","in","the","linear","layer",".","stride","(","int",")",":","Number","of","frames","to","merge","for","the","output","frame","."]
docstr: Args:
      input (torch.Tensor): The log-mel spectrogram input.
          Tensor with dimensions `(batch, time, input_dim)`.
      lengths (torch.Tensor or None): Valid length of each input sample.
          Tensor with dimension `(batch, )`.
  
  Returns:
      (torch.Tensor, torch.Tensor or None):
          torch.Tensor
              Returned feature Tensor after linear layer and time reduction layer.
              Tensor with dimensions `(batch, time // stride, output_dim)`.
          torch.Tensor or None
              The reduced lengths Tensor.
docstr_tok: ["Args",":","input","(","torch.Tensor",")",":","The","log-mel","spectrogram","input",".","Tensor","with","dimensions","`","(","batch",",","time",",","input_dim",")","`",".","lengths","(","torch.Tensor","or","None",")",":","Valid","length","of","each","input","sample",".","Tensor","with","dimension","`","(","batch",",",")","`",".","Returns",":","(","torch.Tensor",",","torch.Tensor","or","None",")",":","torch.Tensor","Returned","feature","Tensor","after","linear","layer","and","time","reduction","layer",".","Tensor","with","dimensions","`","(","batch",",","time","\/\/","stride",",","output_dim",")","`",".","torch.Tensor","or","None","The","reduced","lengths","Tensor","."]
code: def forward(
      self, input: torch.Tensor, lengths: Optional[torch.Tensor]
  ) -> Tuple[torch.Tensor, Optional[torch.Tensor]]:
      """
      Args:
          input (torch.Tensor): The log-mel spectrogram input.
              Tensor with dimensions `(batch, time, input_dim)`.
          lengths (torch.Tensor or None): Valid length of each input sample.
              Tensor with dimension `(batch, )`.
  
      Returns:
          (torch.Tensor, torch.Tensor or None):
              torch.Tensor
                  Returned feature Tensor after linear layer and time reduction layer.
                  Tensor with dimensions `(batch, time // stride, output_dim)`.
              torch.Tensor or None
                  The reduced lengths Tensor.
      """
      output = self.linear(input)
      if lengths is None:
          B, T, _ = input.shape
          dummy_lengths = torch.full((B,), T)
          output, _ = self.time_reduction(output, dummy_lengths)
      else:
          output, lengths = self.time_reduction(output, lengths)
      return output, lengths
  
file_path: audio/src/torchaudio/prototype/models/_emformer_hubert.py
imports: from typing import List, Optional, Tuple
  import torch
  from torchaudio.models import Wav2Vec2Model
  from torchaudio.models.emformer import Emformer
  from torchaudio.models.rnnt import _TimeReduction
label_desc: Use image node_id 2 for calling the FeatureEncoder obj's underlying member method code with example usage: obj.forward(input, lengths) and returns: output,  lengths