class_docstr: Module for alignment text and mel spectrogram.
  
  Args:
      n_mel_channels: Dimension of mel spectrogram.
      n_text_channels: Dimension of text embeddings.
      n_att_channels: Dimension of model
      temperature: Temperature to scale distance by.
          Suggested to be 0.0005 when using dist_type "l2" and 15.0 when using "cosine".
      condition_types: List of types for nemo.collections.tts.modules.submodules.ConditionalInput.
      dist_type: Distance type to use for similarity measurement. Supports "l2" and "cosine" distance.
class_docstr_tok: ["Module","for","alignment","text","and","mel","spectrogram",".","Args",":","n_mel_channels",":","Dimension","of","mel","spectrogram",".","n_text_channels",":","Dimension","of","text","embeddings",".","n_att_channels",":","Dimension","of","model","temperature",":","Temperature","to","scale","distance","by",".","Suggested","to","be","0.0005","when","using","dist_type","``","l2","''","and","15.0","when","using","``","cosine","''",".","condition_types",":","List","of","types","for","nemo.collections.tts.modules.submodules.ConditionalInput",".","dist_type",":","Distance","type","to","use","for","similarity","measurement",".","Supports","``","l2","''","and","``","cosine","''","distance","."]
code: def __init__(
      self,
      n_mel_channels=80,
      n_text_channels=512,
      n_att_channels=80,
      temperature=0.0005,
      condition_types=[],
      dist_type="l2",
  ):
      super().__init__()
      self.temperature = temperature
      self.cond_input = ConditionalInput(
          n_text_channels, n_text_channels, condition_types
      )
      self.softmax = torch.nn.Softmax(dim=3)
      self.log_softmax = torch.nn.LogSoftmax(dim=3)
  
      self.key_proj = nn.Sequential(
          ConvNorm(
              n_text_channels,
              n_text_channels * 2,
              kernel_size=3,
              bias=True,
              w_init_gain="relu",
          ),
          torch.nn.ReLU(),
          ConvNorm(
              n_text_channels * 2,
              n_att_channels,
              kernel_size=1,
              bias=True,
          ),
      )
  
      self.query_proj = nn.Sequential(
          ConvNorm(
              n_mel_channels,
              n_mel_channels * 2,
              kernel_size=3,
              bias=True,
              w_init_gain="relu",
          ),
          torch.nn.ReLU(),
          ConvNorm(
              n_mel_channels * 2,
              n_mel_channels,
              kernel_size=1,
              bias=True,
          ),
          torch.nn.ReLU(),
          ConvNorm(
              n_mel_channels, n_att_channels, kernel_size=1, bias=True
          ),
      )
      if dist_type == "l2":
          self.dist_fn = self.get_euclidean_dist
      elif dist_type == "cosine":
          self.dist_fn = self.get_cosine_dist
      else:
          raise ValueError(f"Unknown distance type '{dist_type}'")
  
file_path: NeMo/nemo/collections/tts/modules/aligner.py
imports: import torch
  from einops import rearrange
  from torch import nn
  from nemo.collections.tts.modules.submodules import ConditionalInput, ConvNorm
  from nemo.collections.tts.parts.utils.helpers import binarize_attention_parallel
label_desc: Use image node_id 1 to create a new AlignmentEncoder object from inherited base classes: torch.nn with example: obj = AlignmentEncoder(n_mel_channels, n_text_channels, n_att_channels, temperature, condition_types, dist_type)