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","."]
docstr: Calculation of durations.
  
  Args:
      attn_soft (torch.tensor): B x 1 x T1 x T2 tensor.
      text_len (torch.tensor): B tensor, lengths of text.
      spect_len (torch.tensor): B tensor, lengths of mel spectrogram.
docstr_tok: ["Calculation","of","durations",".","Args",":","attn_soft","(","torch.tensor",")",":","B","x","1","x","T1","x","T2","tensor",".","text_len","(","torch.tensor",")",":","B","tensor",",","lengths","of","text",".","spect_len","(","torch.tensor",")",":","B","tensor",",","lengths","of","mel","spectrogram","."]
code: def get_durations(attn_soft, text_len, spect_len):
      """Calculation of durations.
  
      Args:
          attn_soft (torch.tensor): B x 1 x T1 x T2 tensor.
          text_len (torch.tensor): B tensor, lengths of text.
          spect_len (torch.tensor): B tensor, lengths of mel spectrogram.
      """
      attn_hard = binarize_attention_parallel(
          attn_soft, text_len, spect_len
      )
      durations = attn_hard.sum(2)[:, 0, :]
      assert torch.all(torch.eq(durations.sum(dim=1), spect_len))
      return durations
  
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 6 for calling the AlignmentEncoder obj's underlying member method code with example usage: obj.get_durations(attn_soft, text_len, spect_len) and returns: durations