docstr: Aligner forward pass.
  
  1. Compute a mask to apply to the attention map.
  2. Run the alignment network.
  3. Apply MAS to compute the hard alignment map.
  4. Compute the durations from the hard alignment map.
  
  Args:
      x (torch.FloatTensor): Input sequence.
      y (torch.FloatTensor): Output sequence.
      x_mask (torch.IntTensor): Input sequence mask.
      y_mask (torch.IntTensor): Output sequence mask.
      attn_priors (torch.FloatTensor): Prior for the aligner network map.
  
  Returns:
      Tuple[torch.IntTensor, torch.FloatTensor, torch.FloatTensor, torch.FloatTensor]:
          Durations from the hard alignment map, soft alignment potentials, log scale alignment potentials,
          hard alignment map.
  
  Shapes:
      - x: :math:`[B, T_en, C_en]`
      - y: :math:`[B, T_de, C_de]`
      - x_mask: :math:`[B, 1, T_en]`
      - y_mask: :math:`[B, 1, T_de]`
      - attn_priors: :math:`[B, T_de, T_en]`
  
      - aligner_durations: :math:`[B, T_en]`
      - aligner_soft: :math:`[B, T_de, T_en]`
      - aligner_logprob: :math:`[B, 1, T_de, T_en]`
      - aligner_mas: :math:`[B, T_de, T_en]`
docstr_tok: ["Aligner","forward","pass",".","1",".","Compute","a","mask","to","apply","to","the","attention","map",".","2",".","Run","the","alignment","network",".","3",".","Apply","MAS","to","compute","the","hard","alignment","map",".","4",".","Compute","the","durations","from","the","hard","alignment","map",".","Args",":","x","(","torch.FloatTensor",")",":","Input","sequence",".","y","(","torch.FloatTensor",")",":","Output","sequence",".","x_mask","(","torch.IntTensor",")",":","Input","sequence","mask",".","y_mask","(","torch.IntTensor",")",":","Output","sequence","mask",".","attn_priors","(","torch.FloatTensor",")",":","Prior","for","the","aligner","network","map",".","Returns",":","Tuple","[","torch.IntTensor",",","torch.FloatTensor",",","torch.FloatTensor",",","torch.FloatTensor","]",":","Durations","from","the","hard","alignment","map",",","soft","alignment","potentials",",","log","scale","alignment","potentials",",","hard","alignment","map",".","Shapes",":","-","x",":",":","math",":","`","[","B",",","T_en",",","C_en","]","`","-","y",":",":","math",":","`","[","B",",","T_de",",","C_de","]","`","-","x_mask",":",":","math",":","`","[","B",",","1",",","T_en","]","`","-","y_mask",":",":","math",":","`","[","B",",","1",",","T_de","]","`","-","attn_priors",":",":","math",":","`","[","B",",","T_de",",","T_en","]","`","-","aligner_durations",":",":","math",":","`","[","B",",","T_en","]","`","-","aligner_soft",":",":","math",":","`","[","B",",","T_de",",","T_en","]","`","-","aligner_logprob",":",":","math",":","`","[","B",",","1",",","T_de",",","T_en","]","`","-","aligner_mas",":",":","math",":","`","[","B",",","T_de",",","T_en","]","`"]
code: def _forward_aligner(
      self,
      x: torch.FloatTensor,
      y: torch.FloatTensor,
      x_mask: torch.IntTensor,
      y_mask: torch.IntTensor,
      attn_priors: torch.FloatTensor,
  ) -> Tuple[
      torch.IntTensor,
      torch.FloatTensor,
      torch.FloatTensor,
      torch.FloatTensor,
  ]:
      """Aligner forward pass.
  
      1. Compute a mask to apply to the attention map.
      2. Run the alignment network.
      3. Apply MAS to compute the hard alignment map.
      4. Compute the durations from the hard alignment map.
  
      Args:
          x (torch.FloatTensor): Input sequence.
          y (torch.FloatTensor): Output sequence.
          x_mask (torch.IntTensor): Input sequence mask.
          y_mask (torch.IntTensor): Output sequence mask.
          attn_priors (torch.FloatTensor): Prior for the aligner network map.
  
      Returns:
          Tuple[torch.IntTensor, torch.FloatTensor, torch.FloatTensor, torch.FloatTensor]:
              Durations from the hard alignment map, soft alignment potentials, log scale alignment potentials,
              hard alignment map.
  
      Shapes:
          - x: :math:`[B, T_en, C_en]`
          - y: :math:`[B, T_de, C_de]`
          - x_mask: :math:`[B, 1, T_en]`
          - y_mask: :math:`[B, 1, T_de]`
          - attn_priors: :math:`[B, T_de, T_en]`
  
          - aligner_durations: :math:`[B, T_en]`
          - aligner_soft: :math:`[B, T_de, T_en]`
          - aligner_logprob: :math:`[B, 1, T_de, T_en]`
          - aligner_mas: :math:`[B, T_de, T_en]`
      """
      attn_mask = torch.unsqueeze(x_mask, -1) * torch.unsqueeze(
          y_mask, 2
      )  # [B, 1, T_en, T_de]
      aligner_soft, aligner_logprob = self.aligner(
          y.transpose(1, 2), x.transpose(1, 2), x_mask, attn_priors
      )
      aligner_mas = maximum_path(
          aligner_soft.squeeze(1).transpose(1, 2).contiguous(),
          attn_mask.squeeze(1).contiguous(),
      )
      aligner_durations = torch.sum(aligner_mas, -1).int()
      aligner_soft = aligner_soft.squeeze(1)  # [B, T_max2, T_max]
      aligner_mas = aligner_mas.transpose(
          1, 2
      )  # [B, T_max, T_max2] -> [B, T_max2, T_max]
      return (
          aligner_durations,
          aligner_soft,
          aligner_logprob,
          aligner_mas,
      )
  
imports: from typing import Callable, Dict, Tuple
  import torch
  import torch.nn.functional
  from coqpit import Coqpit
  from torch import nn
  from TTS.tts.layers.delightful_tts.conformer import Conformer
  from TTS.tts.layers.delightful_tts.encoders import PhonemeLevelProsodyEncoder, UtteranceLevelProsodyEncoder, get_mask_from_lengths
  from TTS.tts.layers.delightful_tts.energy_adaptor import EnergyAdaptor
  from TTS.tts.layers.delightful_tts.networks import EmbeddingPadded, positional_encoding
  from TTS.tts.layers.delightful_tts.phoneme_prosody_predictor import PhonemeProsodyPredictor
  from TTS.tts.layers.delightful_tts.pitch_adaptor import PitchAdaptor
  from TTS.tts.layers.delightful_tts.variance_predictor import VariancePredictor
  from TTS.tts.layers.generic.aligner import AlignmentNetwork
  from TTS.tts.utils.helpers import generate_path, maximum_path, sequence_mask
label_desc: Use image node_id 10 for calling the AcousticModel obj's underlying member method code with example usage: obj._forward_aligner(x, y, x_mask, y_mask, attn_priors) and returns: aligner_durations,  aligner_soft,  aligner_logprob,  aligner_mas