class_docstr: Encoder-Decoder model
code: def _extract_feats(
      self, src_text: torch.Tensor, src_text_lengths: torch.Tensor
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      assert src_text_lengths.dim() == 1, src_text_lengths.shape
  
      # for data-parallel
      src_text = src_text[:, : src_text_lengths.max()]
      src_text, _ = add_sos_eos(
          src_text, self.src_sos, self.src_eos, self.ignore_id
      )
      src_text_lengths = src_text_lengths + 1
  
      if self.frontend is not None:
          # Frontend
          #  e.g. Embedding Lookup
          # src_text (Batch, NSamples) -> feats: (Batch, NSamples, Dim)
          feats, feats_lengths = self.frontend(
              src_text, src_text_lengths
          )
      else:
          # No frontend and no feature extract
          feats, feats_lengths = src_text, src_text_lengths
      return feats, feats_lengths
  
imports: import logging
  from contextlib import contextmanager
  from typing import Dict, List, Optional, Tuple, Union
  import torch
  from packaging.version import parse
  from typeguard import check_argument_types
  from espnet2.asr.decoder.abs_decoder import AbsDecoder
  from espnet2.asr.encoder.abs_encoder import AbsEncoder
  from espnet2.asr.frontend.abs_frontend import AbsFrontend
  from espnet2.asr.postencoder.abs_postencoder import AbsPostEncoder
  from espnet2.asr.preencoder.abs_preencoder import AbsPreEncoder
  from espnet2.torch_utils.device_funcs import force_gatherable
  from espnet2.train.abs_espnet_model import AbsESPnetModel
  from espnet.nets.e2e_mt_common import ErrorCalculator
  from espnet.nets.pytorch_backend.nets_utils import th_accuracy
  from espnet.nets.pytorch_backend.transformer.add_sos_eos import add_sos_eos
  from espnet.nets.pytorch_backend.transformer.label_smoothing_loss import LabelSmoothingLoss
label_desc: Use image node_id 5 for calling the ESPnetMTModel obj's underlying member method code with example usage: obj._extract_feats(src_text, src_text_lengths) and returns: feats,  feats_lengths