class_docstr: Posterior encoder module in VITS.
  
  This is a module of posterior encoder described in `Conditional Variational
  Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`_.
  
  .. _`Conditional Variational Autoencoder with Adversarial Learning for End-to-End
      Text-to-Speech`: https://arxiv.org/abs/2006.04558
docstr: Initilialize PosteriorEncoder module.
  
  Args:
      in_channels (int): Number of input channels.
      out_channels (int): Number of output channels.
      hidden_channels (int): Number of hidden channels.
      kernel_size (int): Kernel size in WaveNet.
      layers (int): Number of layers of WaveNet.
      stacks (int): Number of repeat stacking of WaveNet.
      base_dilation (int): Base dilation factor.
      global_channels (int): Number of global conditioning channels.
      dropout_rate (float): Dropout rate.
      bias (bool): Whether to use bias parameters in conv.
      use_weight_norm (bool): Whether to apply weight norm.
code: def __init__(
      self,
      in_channels: int = 513,
      out_channels: int = 192,
      hidden_channels: int = 192,
      kernel_size: int = 5,
      layers: int = 16,
      stacks: int = 1,
      base_dilation: int = 1,
      global_channels: int = -1,
      dropout_rate: float = 0.0,
      bias: bool = True,
      use_weight_norm: bool = True,
  ):
      """Initilialize PosteriorEncoder module.
  
      Args:
          in_channels (int): Number of input channels.
          out_channels (int): Number of output channels.
          hidden_channels (int): Number of hidden channels.
          kernel_size (int): Kernel size in WaveNet.
          layers (int): Number of layers of WaveNet.
          stacks (int): Number of repeat stacking of WaveNet.
          base_dilation (int): Base dilation factor.
          global_channels (int): Number of global conditioning channels.
          dropout_rate (float): Dropout rate.
          bias (bool): Whether to use bias parameters in conv.
          use_weight_norm (bool): Whether to apply weight norm.
  
      """
      super().__init__()
  
      # define modules
      self.input_conv = Conv1d(in_channels, hidden_channels, 1)
      self.encoder = WaveNet(
          in_channels=-1,
          out_channels=-1,
          kernel_size=kernel_size,
          layers=layers,
          stacks=stacks,
          base_dilation=base_dilation,
          residual_channels=hidden_channels,
          aux_channels=-1,
          gate_channels=hidden_channels * 2,
          skip_channels=hidden_channels,
          global_channels=global_channels,
          dropout_rate=dropout_rate,
          bias=bias,
          use_weight_norm=use_weight_norm,
          use_first_conv=False,
          use_last_conv=False,
          scale_residual=False,
          scale_skip_connect=True,
      )
      self.proj = Conv1d(hidden_channels, out_channels * 2, 1)
  
file_path: espnet/espnet2/gan_tts/vits/posterior_encoder.py
imports: from typing import Optional, Tuple
  import torch
  from espnet2.gan_tts.wavenet import WaveNet
  from espnet2.gan_tts.wavenet.residual_block import Conv1d
  from espnet.nets.pytorch_backend.nets_utils import make_non_pad_mask
label_desc: Use image node_id 1 to create a new PosteriorEncoder object from inherited base classes: torch.nn with example: obj = PosteriorEncoder(in_channels, out_channels, hidden_channels, kernel_size, layers, stacks, base_dilation, global_channels, dropout_rate, bias, use_weight_norm)