class_docstr: Feature Encoder class, consisting of time reduction and linear layer.
  
  Args:
      stride (int): Number of frames to merge for the output frame.
      input_dim (int): Input dimension of the tensor.
      output_dim (int): Output dimension of the tensor.
docstr: Args:
      x (Tensor): Feature Tensor representing log Mel Spectrogram output. shape ``(B, T, D)``.
      lengths (Tensor or None):
          Valid length of each input sample. shape: ``(B, )``.
  
  Returns:
      (Tensor, Optional[Tensor]):
          Tensor: output sequence after undergoing time reduction and linear projection.
              Shape ``(B, T // stride, D * stride).
          Optional[Tensor]: output lengths of shape ``(B,)`` if lengths parameter is provided,
              otherwise `None`.
docstr_tok: ["Args",":","x","(","Tensor",")",":","Feature","Tensor","representing","log","Mel","Spectrogram","output",".","shape","``","(","B",",","T",",","D",")","``",".","lengths","(","Tensor","or","None",")",":","Valid","length","of","each","input","sample",".","shape",":","``","(","B",",",")","``",".","Returns",":","(","Tensor",",","Optional","[","Tensor","]",")",":","Tensor",":","output","sequence","after","undergoing","time","reduction","and","linear","projection",".","Shape","``","(","B",",","T","\/\/","stride",",","D","*","stride",")",".","Optional","[","Tensor","]",":","output","lengths","of","shape","``","(","B",",",")","``","if","lengths","parameter","is","provided",",","otherwise","`","None","`","."]
code: def forward(
      self,
      x: Tensor,
      lengths: Optional[Tensor],
  ) -> Tuple[Tensor, Optional[Tensor]]:
      """
      Args:
          x (Tensor): Feature Tensor representing log Mel Spectrogram output. shape ``(B, T, D)``.
          lengths (Tensor or None):
              Valid length of each input sample. shape: ``(B, )``.
  
      Returns:
          (Tensor, Optional[Tensor]):
              Tensor: output sequence after undergoing time reduction and linear projection.
                  Shape ``(B, T // stride, D * stride).
              Optional[Tensor]: output lengths of shape ``(B,)`` if lengths parameter is provided,
                  otherwise `None`.
      """
      if lengths is None:
          B, T, D = x.shape
          dummy_lengths = torch.full((B,), T)
          x, _ = self.time_reduction_layer(x, dummy_lengths)
          x = self.linear_layer(x)
          return x, None
  
      x, lengths = self.time_reduction_layer(x, lengths)
      x = self.linear_layer(x)
      return x, lengths
  
imports: from typing import List, Optional, Tuple, Union
  import torch
  from torch import nn, Tensor
  from torch.nn import Module, ModuleList
  from torchaudio.models import Wav2Vec2Model
  from torchaudio.models.conformer import ConformerLayer
  from torchaudio.models.rnnt import _TimeReduction
  from torchaudio.models.wav2vec2 import components
label_desc: Use image node_id 2 for calling the FeatureEncoder obj's underlying member method code with example usage: obj.forward(x, lengths) and returns: x,  lengths, x,  None