class_docstr: Conformer architecture introduced in
  *Conformer: Convolution-augmented Transformer for Speech Recognition*
  :cite:`gulati2020conformer`.
  
  Args:
      input_dim (int): input dimension.
      num_heads (int): number of attention heads in each Conformer layer.
      ffn_dim (int): hidden layer dimension of feedforward networks.
      num_layers (int): number of Conformer layers to instantiate.
      depthwise_conv_kernel_size (int): kernel size of each Conformer layer's depthwise convolution layer.
      dropout (float, optional): dropout probability. (Default: 0.0)
      use_group_norm (bool, optional): use ``GroupNorm`` rather than ``BatchNorm1d``
          in the convolution module. (Default: ``False``)
      convolution_first (bool, optional): apply the convolution module ahead of
          the attention module. (Default: ``False``)
  
  Examples:
      >>> conformer = Conformer(
      >>>     input_dim=80,
      >>>     num_heads=4,
      >>>     ffn_dim=128,
      >>>     num_layers=4,
      >>>     depthwise_conv_kernel_size=31,
      >>> )
      >>> lengths = torch.randint(1, 400, (10,))  # (batch,)
      >>> input = torch.rand(10, int(lengths.max()), input_dim)  # (batch, num_frames, input_dim)
      >>> output = conformer(input, lengths)
class_docstr_tok: ["Conformer","architecture","introduced","in","*","Conformer",":","Convolution-augmented","Transformer","for","Speech","Recognition","*",":","cite",":","`","gulati2020conformer","`",".","Args",":","input_dim","(","int",")",":","input","dimension",".","num_heads","(","int",")",":","number","of","attention","heads","in","each","Conformer","layer",".","ffn_dim","(","int",")",":","hidden","layer","dimension","of","feedforward","networks",".","num_layers","(","int",")",":","number","of","Conformer","layers","to","instantiate",".","depthwise_conv_kernel_size","(","int",")",":","kernel","size","of","each","Conformer","layer","'s","depthwise","convolution","layer",".","dropout","(","float",",","optional",")",":","dropout","probability",".","(","Default",":","0.0",")","use_group_norm","(","bool",",","optional",")",":","use","``","GroupNorm","``","rather","than","``","BatchNorm1d","``","in","the","convolution","module",".","(","Default",":","``","False","``",")","convolution_first","(","bool",",","optional",")",":","apply","the","convolution","module","ahead","of","the","attention","module",".","(","Default",":","``","False","``",")","Examples",":",">",">",">","conformer","=","Conformer","(",">",">",">","input_dim=80",",",">",">",">","num_heads=4",",",">",">",">","ffn_dim=128",",",">",">",">","num_layers=4",",",">",">",">","depthwise_conv_kernel_size=31",",",">",">",">",")",">",">",">","lengths","=","torch.randint","(","1",",","400",",","(","10",",",")",")","#","(","batch",",",")",">",">",">","input","=","torch.rand","(","10",",","int","(","lengths.max","(",")",")",",","input_dim",")","#","(","batch",",","num_frames",",","input_dim",")",">",">",">","output","=","conformer","(","input",",","lengths",")"]
code: def __init__(
      self,
      input_dim: int,
      num_heads: int,
      ffn_dim: int,
      num_layers: int,
      depthwise_conv_kernel_size: int,
      dropout: float = 0.0,
      use_group_norm: bool = False,
      convolution_first: bool = False,
  ):
      super().__init__()
  
      self.conformer_layers = torch.nn.ModuleList(
          [
              ConformerLayer(
                  input_dim,
                  ffn_dim,
                  num_heads,
                  depthwise_conv_kernel_size,
                  dropout=dropout,
                  use_group_norm=use_group_norm,
                  convolution_first=convolution_first,
              )
              for _ in range(num_layers)
          ]
      )
  
imports: from typing import Optional, Tuple
  import torch
label_desc: Use image node_id 1 to create a new Conformer object from inherited base classes: torch.nn with example: obj = Conformer(input_dim, num_heads, ffn_dim, num_layers, depthwise_conv_kernel_size, dropout, use_group_norm, convolution_first)