class_docstr: This class implements the Conformer encoder.
  
  Arguments
  ---------
  num_layers : int
      Number of layers.
  d_model : int
      Embedding dimension size.
  d_ffn : int
      Hidden size of self-attention Feed Forward layer.
  nhead : int
      Number of attention heads.
  kernel_size : int, optional
      Kernel size of convolution model.
  kdim : int, optional
      Dimension of the key.
  vdim : int, optional
      Dimension of the value.
  activation: torch.nn.Module
       Activation function used in each Confomer layer.
  bias : bool, optional
      Whether  convolution module.
  dropout : int, optional
      Dropout for the encoder.
  causal: bool, optional
      Whether the convolutions should be causal or not.
  attention_type: str, optional
      type of attention layer, e.g. regulaMHA for regular MultiHeadAttention.
  
  
  Example
  -------
  >>> import torch
  >>> x = torch.rand((8, 60, 512))
  >>> pos_emb = torch.rand((1, 2*60-1, 512))
  >>> net = ConformerEncoder(1, 512, 512, 8)
  >>> output, _ = net(x, pos_embs=pos_emb)
  >>> output.shape
  torch.Size([8, 60, 512])
code: def __init__(
      self,
      num_layers,
      d_model,
      d_ffn,
      nhead,
      kernel_size=31,
      kdim=None,
      vdim=None,
      activation=Swish,
      bias=True,
      dropout=0.0,
      causal=False,
      attention_type="RelPosMHAXL",
  ):
      super().__init__()
  
      self.layers = torch.nn.ModuleList(
          [
              ConformerEncoderLayer(
                  d_ffn=d_ffn,
                  nhead=nhead,
                  d_model=d_model,
                  kdim=kdim,
                  vdim=vdim,
                  dropout=dropout,
                  activation=activation,
                  kernel_size=kernel_size,
                  bias=bias,
                  causal=causal,
                  attention_type=attention_type,
              )
              for i in range(num_layers)
          ]
      )
      self.norm = LayerNorm(d_model, eps=1e-6)
      self.attention_type = attention_type
  
imports: from dataclasses import dataclass
  import torch
  import torch.nn
  import torch.nn.functional
  from typing import Optional, List
  import speechbrain
  import warnings
  from speechbrain.nnet.attention import RelPosMHAXL, MultiheadAttention, PositionalwiseFeedForward
  from speechbrain.utils.dynamic_chunk_training import DynChunkTrainConfig
  from speechbrain.lobes.models.transformer.hypermixing import HyperMixing
  from speechbrain.nnet.normalization import LayerNorm
  from speechbrain.nnet.activations import Swish
label_desc: Use image node_id 1 to create a new ConformerEncoder object from inherited base classes: nn with example: obj = ConformerEncoder(num_layers, d_model, d_ffn, nhead, kernel_size, kdim, vdim, activation, bias, dropout, causal, attention_type)