class_docstr: Target Speaker Extraction Frontend model
class_docstr_tok: ["Target","Speaker","Extraction","Frontend","model"]
code: def forward_enhance(
      self,
      speech_mix: torch.Tensor,
      speech_lengths: torch.Tensor,
      enroll_ref: torch.Tensor,
      enroll_ref_lengths: torch.Tensor,
      additional: Optional[Dict] = None,
  ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
      feature_mix, flens = self.encoder(speech_mix, speech_lengths)
      if self.share_encoder:
          feature_aux, flens_aux = zip(
              *[
                  self.encoder(enroll_ref[spk], enroll_ref_lengths[spk])
                  for spk in range(len(enroll_ref))
              ]
          )
      else:
          feature_aux = enroll_ref
          flens_aux = enroll_ref_lengths
  
      feature_pre, _, others = zip(
          *[
              self.extractor(
                  feature_mix,
                  flens,
                  feature_aux[spk],
                  flens_aux[spk],
                  suffix_tag=f"_spk{spk + 1}",
                  additional=additional,
              )
              for spk in range(len(enroll_ref))
          ]
      )
      others = {k: v for dic in others for k, v in dic.items()}
      if feature_pre[0] is not None:
          speech_pre = [
              self.decoder(ps, speech_lengths)[0] for ps in feature_pre
          ]
      else:
          # some models (e.g. neural beamformer trained with mask loss)
          # do not predict time-domain signal in the training stage
          speech_pre = None
      return speech_pre, feature_mix, feature_pre, others
  
imports: import contextlib
  from typing import Dict, List, Optional, OrderedDict, Tuple
  import torch
  from typeguard import check_argument_types
  from espnet2.enh.decoder.abs_decoder import AbsDecoder
  from espnet2.enh.encoder.abs_encoder import AbsEncoder
  from espnet2.enh.extractor.abs_extractor import AbsExtractor
  from espnet2.enh.loss.criterions.tf_domain import FrequencyDomainLoss
  from espnet2.enh.loss.criterions.time_domain import TimeDomainLoss
  from espnet2.enh.loss.wrappers.abs_wrapper import AbsLossWrapper
  from espnet2.torch_utils.device_funcs import force_gatherable
  from espnet2.train.abs_espnet_model import AbsESPnetModel
label_desc: Use image node_id 3 for calling the ESPnetExtractionModel obj's underlying member method code with example usage: obj.forward_enhance(speech_mix, speech_lengths, enroll_ref, enroll_ref_lengths, additional) and returns: speech_pre,  feature_mix,  feature_pre,  others