class_docstr: FairSeq Hubert pretrain encoder module, only used for pretraining stage
  
  Args:
      input_size: input dim
      output_size: dimension of attention
      linear_units: dimension of feedforward layers
      attention_heads: the number of heads of multi head attention
      num_blocks: the number of encoder blocks
      dropout_rate: dropout rate
      attention_dropout_rate: dropout rate in attention
      hubert_dict: target dictionary for Hubert pretraining
      label_rate: label frame rate. -1 for sequence label
      sample_rate: target sample rate.
      use_amp: whether to use automatic mixed precision
      normalize_before: whether to use layer_norm before the first block
docstr: Forward Hubert Pretrain Encoder.
  
  Args:
      xs_pad: input tensor (B, L, D)
      ilens: input length (B)
      prev_states: Not to be used now.
  Returns:
      position embedded tensor and mask
docstr_tok: ["Forward","Hubert","Pretrain","Encoder",".","Args",":","xs_pad",":","input","tensor","(","B",",","L",",","D",")","ilens",":","input","length","(","B",")","prev_states",":","Not","to","be","used","now",".","Returns",":","position","embedded","tensor","and","mask"]
code: def forward(
      self,
      xs_pad: torch.Tensor,
      ilens: torch.Tensor,
      ys_pad: torch.Tensor,
      ys_pad_length: torch.Tensor,
      prev_states: torch.Tensor = None,
  ) -> Tuple[torch.Tensor, torch.Tensor, Optional[torch.Tensor]]:
      """Forward Hubert Pretrain Encoder.
  
      Args:
          xs_pad: input tensor (B, L, D)
          ilens: input length (B)
          prev_states: Not to be used now.
      Returns:
          position embedded tensor and mask
      """
      self.cast_mask_emb()
      masks = make_pad_mask(ilens).to(xs_pad.device)
      ys_pad = ys_pad[:, : min(ys_pad_length)]
      enc_outputs = self.encoder(
          xs_pad,
          padding_mask=masks,
          mask=True,
          target_list=[ys_pad],
          features_only=False,
      )
      return enc_outputs
  
imports: import contextlib
  import copy
  import logging
  import os
  from pathlib import Path
  from typing import List, Optional, Tuple
  import torch
  import yaml
  from filelock import FileLock
  from typeguard import check_argument_types
  from espnet2.asr.encoder.abs_encoder import AbsEncoder
  from espnet.nets.pytorch_backend.nets_utils import make_pad_mask
  from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm
label_desc: Use image node_id 4 for calling the FairseqHubertPretrainEncoder obj's underlying member method code with example usage: obj.forward(xs_pad, ilens, ys_pad, ys_pad_length, prev_states) and returns: enc_outputs