docstr: A Conformer block is composed of four modules stacked together,
  A feed-forward module, a self-attention module, a convolution module,
  and a second feed-forward module in the end. The block starts with two Feed forward
  modules sandwiching the Multi-Headed Self-Attention module and the Conv module.
  
  Args:
      d_model (int): The dimension of model
      n_head (int): The number of attention heads.
      kernel_size_conv_mod (int): Size of kernels for convolution modules.
      speaker_embedding_dim (int): Number of speaker embedding dimensions.
      emotion_embedding_dim (int): Number of emotion embedding dimensions.
      dropout (float): Probabilty of dropout.
  
  Inputs: inputs, mask
      - **inputs** (batch, time, dim): Tensor containing input vector
      - **encoding** (batch, time, dim): Positional embedding tensor
      - **slf_attn_mask** (batch, 1, 1, time1): Tensor containing indices to be masked in self attention module
      - **mask** (batch, 1, time2) or (batch, time1, time2): Tensor containing indices to be masked
  Returns:
      - **outputs** (batch, time, dim): Tensor produced by the Conformer Block.
docstr_tok: ["A","Conformer","block","is","composed","of","four","modules","stacked","together",",","A","feed-forward","module",",","a","self-attention","module",",","a","convolution","module",",","and","a","second","feed-forward","module","in","the","end",".","The","block","starts","with","two","Feed","forward","modules","sandwiching","the","Multi-Headed","Self-Attention","module","and","the","Conv","module",".","Args",":","d_model","(","int",")",":","The","dimension","of","model","n_head","(","int",")",":","The","number","of","attention","heads",".","kernel_size_conv_mod","(","int",")",":","Size","of","kernels","for","convolution","modules",".","speaker_embedding_dim","(","int",")",":","Number","of","speaker","embedding","dimensions",".","emotion_embedding_dim","(","int",")",":","Number","of","emotion","embedding","dimensions",".","dropout","(","float",")",":","Probabilty","of","dropout",".","Inputs",":","inputs",",","mask","-","*","*","inputs","*","*","(","batch",",","time",",","dim",")",":","Tensor","containing","input","vector","-","*","*","encoding","*","*","(","batch",",","time",",","dim",")",":","Positional","embedding","tensor","-","*","*","slf_attn_mask","*","*","(","batch",",","1",",","1",",","time1",")",":","Tensor","containing","indices","to","be","masked","in","self","attention","module","-","*","*","mask","*","*","(","batch",",","1",",","time2",")","or","(","batch",",","time1",",","time2",")",":","Tensor","containing","indices","to","be","masked","Returns",":","-","*","*","outputs","*","*","(","batch",",","time",",","dim",")",":","Tensor","produced","by","the","Conformer","Block","."]
code: def __init__(
      self,
      d_model: int,
      n_head: int,
      d_k: int,  # pylint: disable=unused-argument
      d_v: int,  # pylint: disable=unused-argument
      kernel_size_conv_mod: int,
      speaker_embedding_dim: int,
      dropout: float,
      lrelu_slope: float = 0.3,
  ):
      """
      A Conformer block is composed of four modules stacked together,
      A feed-forward module, a self-attention module, a convolution module,
      and a second feed-forward module in the end. The block starts with two Feed forward
      modules sandwiching the Multi-Headed Self-Attention module and the Conv module.
  
      Args:
          d_model (int): The dimension of model
          n_head (int): The number of attention heads.
          kernel_size_conv_mod (int): Size of kernels for convolution modules.
          speaker_embedding_dim (int): Number of speaker embedding dimensions.
          emotion_embedding_dim (int): Number of emotion embedding dimensions.
          dropout (float): Probabilty of dropout.
  
      Inputs: inputs, mask
          - **inputs** (batch, time, dim): Tensor containing input vector
          - **encoding** (batch, time, dim): Positional embedding tensor
          - **slf_attn_mask** (batch, 1, 1, time1): Tensor containing indices to be masked in self attention module
          - **mask** (batch, 1, time2) or (batch, time1, time2): Tensor containing indices to be masked
      Returns:
          - **outputs** (batch, time, dim): Tensor produced by the Conformer Block.
      """
      super().__init__()
      if isinstance(speaker_embedding_dim, int):
          self.conditioning = Conv1dGLU(
              d_model=d_model,
              kernel_size=kernel_size_conv_mod,
              padding=kernel_size_conv_mod // 2,
              embedding_dim=speaker_embedding_dim,
          )
  
      self.ff = FeedForward(
          d_model=d_model,
          dropout=dropout,
          kernel_size=3,
          lrelu_slope=lrelu_slope,
      )
      self.conformer_conv_1 = ConformerConvModule(
          d_model,
          kernel_size=kernel_size_conv_mod,
          dropout=dropout,
          lrelu_slope=lrelu_slope,
      )
      self.ln = nn.LayerNorm(d_model)
      self.slf_attn = ConformerMultiHeadedSelfAttention(
          d_model=d_model, num_heads=n_head, dropout_p=dropout
      )
      self.conformer_conv_2 = ConformerConvModule(
          d_model,
          kernel_size=kernel_size_conv_mod,
          dropout=dropout,
          lrelu_slope=lrelu_slope,
      )
  
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 ConformerBlock object from inherited base classes: torch.nn with example: obj = ConformerBlock(d_model, n_head, d_k, d_v, kernel_size_conv_mod, speaker_embedding_dim, dropout, lrelu_slope)