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."""
      xs_pad = input
      masks = (~make_pad_mask(input_lengths)).to(input[0].device)
      # print(mask)
      if self.embed is None:
          xs_pad = xs_pad
      else:
          xs_pad = self.embed(xs_pad)
      masks = masks.reshape(masks.shape[0], 1, masks.shape[1])
      xs_pad, masks = self.encoders(xs_pad, masks)
  
      if isinstance(xs_pad, tuple):
          xs_pad = xs_pad[0]
      if self.normalize_before:
          xs_pad = self.after_norm(xs_pad)
  
      olens = masks.squeeze(1).sum(1)
  
      return xs_pad, olens
  
file_path: espnet/espnet2/slu/postencoder/conformer_postencoder.py
imports: import logging
  from typing import Tuple
  import torch
  from typeguard import check_argument_types
  from espnet2.asr.postencoder.abs_postencoder import AbsPostEncoder
  from espnet.nets.pytorch_backend.conformer.convolution import ConvolutionModule
  from espnet.nets.pytorch_backend.conformer.encoder_layer import EncoderLayer
  from espnet.nets.pytorch_backend.nets_utils import get_activation, make_pad_mask
  from espnet.nets.pytorch_backend.transformer.attention import LegacyRelPositionMultiHeadedAttention, MultiHeadedAttention, RelPositionMultiHeadedAttention
  from espnet.nets.pytorch_backend.transformer.embedding import LegacyRelPositionalEncoding, PositionalEncoding, RelPositionalEncoding, ScaledPositionalEncoding
  from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm
  from espnet.nets.pytorch_backend.transformer.multi_layer_conv import Conv1dLinear, MultiLayeredConv1d
  from espnet.nets.pytorch_backend.transformer.positionwise_feed_forward import PositionwiseFeedForward
  from espnet.nets.pytorch_backend.transformer.repeat import repeat
label_desc: Use image node_id 2 for calling the ConformerPostEncoder obj's underlying member method code with example usage: obj.forward(input, input_lengths) and returns: xs_pad,  olens