class_docstr: Emformer Encoder class for HuBERT pre-training. Consists of emformer module,
      linear layer and layer normalization layer.
  
  Args:
      emformer (torch.nn.Module):
          :py:class:`torchaudio.models.Emformer` module that consists of a list of emformer layers.
      output_linear (torch.nn.Module):
          Linear layer after emformer module.
      layer_norm (torch.nn.Module):
          Apply layer normalization to the output.
class_docstr_tok: ["Emformer","Encoder","class","for","HuBERT","pre-training",".","Consists","of","emformer","module",",","linear","layer","and","layer","normalization","layer",".","Args",":","emformer","(","torch.nn.Module",")",":",":","py",":","class",":","`","torchaudio.models.Emformer","`","module","that","consists","of","a","list","of","emformer","layers",".","output_linear","(","torch.nn.Module",")",":","Linear","layer","after","emformer","module",".","layer_norm","(","torch.nn.Module",")",":","Apply","layer","normalization","to","the","output","."]
docstr: Args:
      input (torch.Tensor): The input feature for emformer encoder.
          Tensor with dimensions `(batch, time, feature_dim)`.
      lengths (torch.Tensor or None): Valid length of each input sample.
          Tensor with dimension `(batch, )`.
  
  Returns:
      torch.Tensor: The feature Tensor after emformer encoder.
docstr_tok: ["Args",":","input","(","torch.Tensor",")",":","The","input","feature","for","emformer","encoder",".","Tensor","with","dimensions","`","(","batch",",","time",",","feature_dim",")","`",".","lengths","(","torch.Tensor","or","None",")",":","Valid","length","of","each","input","sample",".","Tensor","with","dimension","`","(","batch",",",")","`",".","Returns",":","torch.Tensor",":","The","feature","Tensor","after","emformer","encoder","."]
code: def forward(
      self,
      input: torch.Tensor,
      lengths: Optional[torch.Tensor],
  ) -> torch.Tensor:
      """
      Args:
          input (torch.Tensor): The input feature for emformer encoder.
              Tensor with dimensions `(batch, time, feature_dim)`.
          lengths (torch.Tensor or None): Valid length of each input sample.
              Tensor with dimension `(batch, )`.
  
      Returns:
          torch.Tensor: The feature Tensor after emformer encoder.
      """
      if lengths is None:
          B, T, _ = input.shape
          dummy_lengths = torch.full((B,), T)
          output, _ = self.emformer(input, dummy_lengths)
      else:
          output, lengths = self.emformer(input, lengths)
      output = self.output_linear(output)
      output = self.layer_norm(output)
      return output
  
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 EmformerEncoder obj's underlying member method code with example usage: obj.forward(input, lengths) and returns: output