class_docstr: Hugging Face Transformers PostEncoder.
class_docstr_tok: ["Hugging","Face","Transformers","PostEncoder","."]
docstr: Forward.
docstr_tok: ["Forward","."]
code: def forward(
      self, input: torch.Tensor, input_lengths: torch.Tensor
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      """Forward."""
  
      args = {"return_dict": True}
  
      if self.lang_token_id != -1:
          input = torch.cat(
              (
                  torch.tensor(
                      [self.lang_token_id] * input.shape[0],
                      device=input.device,
                  ).unsqueeze(1),
                  input,
              ),
              dim=-1,
          )
          input_lengths = input_lengths + 1
  
      args["input_ids"] = input
  
      mask = (~make_pad_mask(input_lengths)).to(input.device).float()
      args["attention_mask"] = mask
      output = self.transformer(**args).last_hidden_state
  
      return output, input_lengths
  
file_path: espnet/espnet2/asr/encoder/hugging_face_transformers_encoder.py
imports: import copy
  import logging
  from typing import Tuple
  import torch
  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
label_desc: Use image node_id 2 for calling the HuggingFaceTransformersEncoder obj's underlying member method code with example usage: obj.forward(input, input_lengths) and returns: output,  input_lengths