class_docstr: Glow TTS models from https://arxiv.org/abs/2005.11129
  
  Args:
      num_chars (int): number of embedding characters.
      hidden_channels_enc (int): number of embedding and encoder channels.
      hidden_channels_dec (int): number of decoder channels.
      use_encoder_prenet (bool): enable/disable prenet for encoder. Prenet modules are hard-coded for each alternative encoder.
      hidden_channels_dp (int): number of duration predictor channels.
      out_channels (int): number of output channels. It should be equal to the number of spectrogram filter.
      num_flow_blocks_dec (int): number of decoder blocks.
      kernel_size_dec (int): decoder kernel size.
      dilation_rate (int): rate to increase dilation by each layer in a decoder block.
      num_block_layers (int): number of decoder layers in each decoder block.
      dropout_p_dec (float): dropout rate for decoder.
      num_speaker (int): number of speaker to define the size of speaker embedding layer.
      c_in_channels (int): number of speaker embedding channels. It is set to 512 if embeddings are learned.
      num_splits (int): number of split levels in inversible conv1x1 operation.
      num_squeeze (int): number of squeeze levels. When squeezing channels increases and time steps reduces by the factor 'num_squeeze'.
      sigmoid_scale (bool): enable/disable sigmoid scaling in decoder.
      mean_only (bool): if True, encoder only computes mean value and uses constant variance for each time step.
      encoder_type (str): encoder module type.
      encoder_params (dict): encoder module parameters.
      external_speaker_embedding_dim (int): channels of external speaker embedding vectors.
class_docstr_tok: ["Glow","TTS","models","from","https",":","\/\/arxiv.org\/abs\/2005.11129","Args",":","num_chars","(","int",")",":","number","of","embedding","characters",".","hidden_channels_enc","(","int",")",":","number","of","embedding","and","encoder","channels",".","hidden_channels_dec","(","int",")",":","number","of","decoder","channels",".","use_encoder_prenet","(","bool",")",":","enable\/disable","prenet","for","encoder",".","Prenet","modules","are","hard-coded","for","each","alternative","encoder",".","hidden_channels_dp","(","int",")",":","number","of","duration","predictor","channels",".","out_channels","(","int",")",":","number","of","output","channels",".","It","should","be","equal","to","the","number","of","spectrogram","filter",".","num_flow_blocks_dec","(","int",")",":","number","of","decoder","blocks",".","kernel_size_dec","(","int",")",":","decoder","kernel","size",".","dilation_rate","(","int",")",":","rate","to","increase","dilation","by","each","layer","in","a","decoder","block",".","num_block_layers","(","int",")",":","number","of","decoder","layers","in","each","decoder","block",".","dropout_p_dec","(","float",")",":","dropout","rate","for","decoder",".","num_speaker","(","int",")",":","number","of","speaker","to","define","the","size","of","speaker","embedding","layer",".","c_in_channels","(","int",")",":","number","of","speaker","embedding","channels",".","It","is","set","to","512","if","embeddings","are","learned",".","num_splits","(","int",")",":","number","of","split","levels","in","inversible","conv1x1","operation",".","num_squeeze","(","int",")",":","number","of","squeeze","levels",".","When","squeezing","channels","increases","and","time","steps","reduces","by","the","factor","'num_squeeze","'",".","sigmoid_scale","(","bool",")",":","enable\/disable","sigmoid","scaling","in","decoder",".","mean_only","(","bool",")",":","if","True",",","encoder","only","computes","mean","value","and","uses","constant","variance","for","each","time","step",".","encoder_type","(","str",")",":","encoder","module","type",".","encoder_params","(","dict",")",":","encoder","module","parameters",".","external_speaker_embedding_dim","(","int",")",":","channels","of","external","speaker","embedding","vectors","."]
code: def __init__(
      self,
      num_chars,
      hidden_channels_enc,
      hidden_channels_dec,
      use_encoder_prenet,
      hidden_channels_dp,
      out_channels,
      num_flow_blocks_dec=12,
      kernel_size_dec=5,
      dilation_rate=5,
      num_block_layers=4,
      dropout_p_dp=0.1,
      dropout_p_dec=0.05,
      num_speakers=0,
      c_in_channels=0,
      num_splits=4,
      num_squeeze=1,
      sigmoid_scale=False,
      mean_only=False,
      encoder_type="transformer",
      encoder_params=None,
      external_speaker_embedding_dim=None,
  ):
      super().__init__()
      self.num_chars = num_chars
      self.hidden_channels_dp = hidden_channels_dp
      self.hidden_channels_enc = hidden_channels_enc
      self.hidden_channels_dec = hidden_channels_dec
      self.out_channels = out_channels
      self.num_flow_blocks_dec = num_flow_blocks_dec
      self.kernel_size_dec = kernel_size_dec
      self.dilation_rate = dilation_rate
      self.num_block_layers = num_block_layers
      self.dropout_p_dec = dropout_p_dec
      self.num_speakers = num_speakers
      self.c_in_channels = c_in_channels
      self.num_splits = num_splits
      self.num_squeeze = num_squeeze
      self.sigmoid_scale = sigmoid_scale
      self.mean_only = mean_only
      self.use_encoder_prenet = use_encoder_prenet
  
      # model constants.
      self.noise_scale = 0.33  # defines the noise variance applied to the random z vector at inference.
      self.length_scale = 1.0  # scaler for the duration predictor. The larger it is, the slower the speech.
      self.external_speaker_embedding_dim = (
          external_speaker_embedding_dim
      )
  
      # if is a multispeaker and c_in_channels is 0, set to 256
      if num_speakers > 1:
          if (
              self.c_in_channels == 0
              and not self.external_speaker_embedding_dim
          ):
              self.c_in_channels = 512
          elif self.external_speaker_embedding_dim:
              self.c_in_channels = self.external_speaker_embedding_dim
  
      self.encoder = Encoder(
          num_chars,
          out_channels=out_channels,
          hidden_channels=hidden_channels_enc,
          hidden_channels_dp=hidden_channels_dp,
          encoder_type=encoder_type,
          encoder_params=encoder_params,
          mean_only=mean_only,
          use_prenet=use_encoder_prenet,
          dropout_p_dp=dropout_p_dp,
          c_in_channels=self.c_in_channels,
      )
  
      self.decoder = Decoder(
          out_channels,
          hidden_channels_dec,
          kernel_size_dec,
          dilation_rate,
          num_flow_blocks_dec,
          num_block_layers,
          dropout_p=dropout_p_dec,
          num_splits=num_splits,
          num_squeeze=num_squeeze,
          sigmoid_scale=sigmoid_scale,
          c_in_channels=self.c_in_channels,
      )
  
      if num_speakers > 1 and not external_speaker_embedding_dim:
          # speaker embedding layer
          self.emb_g = nn.Embedding(num_speakers, self.c_in_channels)
          nn.init.uniform_(self.emb_g.weight, -0.1, 0.1)
  
file_path: TTS/TTS/tts/models/glow_tts.py
imports: import math
  import torch
  from torch import nn
  from torch.nn import functional
  from TTS.tts.layers.glow_tts.encoder import Encoder
  from TTS.tts.layers.glow_tts.decoder import Decoder
  from TTS.tts.utils.generic_utils import sequence_mask
  from TTS.tts.layers.glow_tts.monotonic_align import maximum_path, generate_path
label_desc: Use image node_id 1 to create a new GlowTts object from inherited base classes: nn with example: obj = GlowTts(num_chars, hidden_channels_enc, hidden_channels_dec, use_encoder_prenet, hidden_channels_dp, out_channels, num_flow_blocks_dec, kernel_size_dec, dilation_rate, num_block_layers, dropout_p_dp, dropout_p_dec, num_speakers, c_in_channels, num_splits, num_squeeze, sigmoid_scale, mean_only, encoder_type, encoder_params, external_speaker_embedding_dim)