docstr: A Transformer variant that integrates both CNNs and Transformers components.
  Conformer proposes a novel combination of self-attention and convolution, in which self-attention
  learns the global interaction while the convolutions efficiently capture the local correlations.
  
  Args:
      dim (int): Number of the dimensions for the model.
      n_layers (int): Number of model layers.
      n_heads (int): The number of attention heads.
      speaker_embedding_dim (int): Number of speaker embedding dimensions.
      p_dropout (float): Probabilty of dropout.
      kernel_size_conv_mod (int): Size of kernels for convolution modules.
  
  Inputs: inputs, mask
      - **inputs** (batch, time, dim): Tensor containing input vector
      - **encoding** (batch, time, dim): Positional embedding tensor
      - **mask** (batch, 1, time2) or (batch, time1, time2): Tensor containing indices to be masked
  Returns:
      - **outputs** (batch, time, dim): Tensor produced by Conformer Encoder.
docstr_tok: ["A","Transformer","variant","that","integrates","both","CNNs","and","Transformers","components",".","Conformer","proposes","a","novel","combination","of","self-attention","and","convolution",",","in","which","self-attention","learns","the","global","interaction","while","the","convolutions","efficiently","capture","the","local","correlations",".","Args",":","dim","(","int",")",":","Number","of","the","dimensions","for","the","model",".","n_layers","(","int",")",":","Number","of","model","layers",".","n_heads","(","int",")",":","The","number","of","attention","heads",".","speaker_embedding_dim","(","int",")",":","Number","of","speaker","embedding","dimensions",".","p_dropout","(","float",")",":","Probabilty","of","dropout",".","kernel_size_conv_mod","(","int",")",":","Size","of","kernels","for","convolution","modules",".","Inputs",":","inputs",",","mask","-","*","*","inputs","*","*","(","batch",",","time",",","dim",")",":","Tensor","containing","input","vector","-","*","*","encoding","*","*","(","batch",",","time",",","dim",")",":","Positional","embedding","tensor","-","*","*","mask","*","*","(","batch",",","1",",","time2",")","or","(","batch",",","time1",",","time2",")",":","Tensor","containing","indices","to","be","masked","Returns",":","-","*","*","outputs","*","*","(","batch",",","time",",","dim",")",":","Tensor","produced","by","Conformer","Encoder","."]
code: def __init__(
      self,
      dim: int,
      n_layers: int,
      n_heads: int,
      speaker_embedding_dim: int,
      p_dropout: float,
      kernel_size_conv_mod: int,
      lrelu_slope: float,
  ):
      """
      A Transformer variant that integrates both CNNs and Transformers components.
      Conformer proposes a novel combination of self-attention and convolution, in which self-attention
      learns the global interaction while the convolutions efficiently capture the local correlations.
  
      Args:
          dim (int): Number of the dimensions for the model.
          n_layers (int): Number of model layers.
          n_heads (int): The number of attention heads.
          speaker_embedding_dim (int): Number of speaker embedding dimensions.
          p_dropout (float): Probabilty of dropout.
          kernel_size_conv_mod (int): Size of kernels for convolution modules.
  
      Inputs: inputs, mask
          - **inputs** (batch, time, dim): Tensor containing input vector
          - **encoding** (batch, time, dim): Positional embedding tensor
          - **mask** (batch, 1, time2) or (batch, time1, time2): Tensor containing indices to be masked
      Returns:
          - **outputs** (batch, time, dim): Tensor produced by Conformer Encoder.
      """
      super().__init__()
      d_k = d_v = dim // n_heads
      self.layer_stack = nn.ModuleList(
          [
              ConformerBlock(
                  dim,
                  n_heads,
                  d_k,
                  d_v,
                  kernel_size_conv_mod=kernel_size_conv_mod,
                  dropout=p_dropout,
                  speaker_embedding_dim=speaker_embedding_dim,
                  lrelu_slope=lrelu_slope,
              )
              for _ in range(n_layers)
          ]
      )
  
imports: import math
  from typing import Tuple
  import torch
  import torch.nn
  import torch.nn.functional
  from TTS.tts.layers.delightful_tts.conv_layers import Conv1dGLU, DepthWiseConv1d, PointwiseConv1d
  from TTS.tts.layers.delightful_tts.networks import GLUActivation
label_desc: Use image node_id 1 to create a new Conformer object from inherited base classes: nn with example: obj = Conformer(dim, n_layers, n_heads, speaker_embedding_dim, p_dropout, kernel_size_conv_mod, lrelu_slope)