class_docstr: The convolution module for the Conformer model.
  Args:
      d_model (int): hidden dimension
      kernel_size (int): kernel size for depthwise convolution
      pointwise_activation (str): name of the activation function to be used for the pointwise conv.
          Note that Conformer uses a special key `glu_` which is treated as the original default from
          the paper.
class_docstr_tok: ["The","convolution","module","for","the","Conformer","model",".","Args",":","d_model","(","int",")",":","hidden","dimension","kernel_size","(","int",")",":","kernel","size","for","depthwise","convolution","pointwise_activation","(","str",")",":","name","of","the","activation","function","to","be","used","for","the","pointwise","conv",".","Note","that","Conformer","uses","a","special","key","`","glu_","`","which","is","treated","as","the","original","default","from","the","paper","."]
code: def __init__(
      self,
      d_model,
      kernel_size,
      norm_type="batch_norm",
      conv_context_size=None,
      pointwise_activation="glu_",
  ):
      super(ConformerConvolution, self).__init__()
      assert (kernel_size - 1) % 2 == 0
      self.d_model = d_model
      self.kernel_size = kernel_size
      self.norm_type = norm_type
  
      if conv_context_size is None:
          conv_context_size = (kernel_size - 1) // 2
  
      if pointwise_activation in activation_registry:
          self.pointwise_activation = activation_registry[
              pointwise_activation
          ]()
          dw_conv_input_dim = d_model * 2
  
          if hasattr(self.pointwise_activation, "inplace"):
              self.pointwise_activation.inplace = True
      else:
          self.pointwise_activation = pointwise_activation
          dw_conv_input_dim = d_model
  
      self.pointwise_conv1 = nn.Conv1d(
          in_channels=d_model,
          out_channels=d_model * 2,
          kernel_size=1,
          stride=1,
          padding=0,
          bias=True,
      )
  
      self.depthwise_conv = CausalConv1D(
          in_channels=dw_conv_input_dim,
          out_channels=dw_conv_input_dim,
          kernel_size=kernel_size,
          stride=1,
          padding=conv_context_size,
          groups=dw_conv_input_dim,
          bias=True,
      )
  
      if norm_type == "batch_norm":
          self.batch_norm = nn.BatchNorm1d(dw_conv_input_dim)
      elif norm_type == "instance_norm":
          self.batch_norm = nn.InstanceNorm1d(dw_conv_input_dim)
      elif norm_type == "layer_norm":
          self.batch_norm = nn.LayerNorm(dw_conv_input_dim)
      elif norm_type == "fused_batch_norm":
          self.batch_norm = FusedBatchNorm1d(dw_conv_input_dim)
      elif norm_type.startswith("group_norm"):
          num_groups = int(norm_type.replace("group_norm", ""))
          self.batch_norm = nn.GroupNorm(
              num_groups=num_groups, num_channels=d_model
          )
      else:
          raise ValueError(f"conv_norm_type={norm_type} is not valid!")
  
      self.activation = Swish()
      self.pointwise_conv2 = nn.Conv1d(
          in_channels=dw_conv_input_dim,
          out_channels=d_model,
          kernel_size=1,
          stride=1,
          padding=0,
          bias=True,
      )
  
imports: import torch
  from torch import nn
  from torch.nn import LayerNorm
  from nemo.collections.asr.parts.submodules.batchnorm import FusedBatchNorm1d
  from nemo.collections.asr.parts.submodules.causal_convs import CausalConv1D
  from nemo.collections.asr.parts.submodules.multi_head_attention import MultiHeadAttention, RelPositionMultiHeadAttention, RelPositionMultiHeadAttentionLongformer
  from nemo.collections.asr.parts.utils.activations import Swish
  from nemo.collections.common.parts import adapter_modules
  from nemo.collections.common.parts.utils import activation_registry
  from nemo.core.classes.mixins import AccessMixin
  from nemo.core.classes.mixins.adapter_mixins import AdapterModuleMixin
label_desc: Use image node_id 1 to create a new ConformerConvolution object from inherited base classes: nn with example: obj = ConformerConvolution(d_model, kernel_size, norm_type, conv_context_size, pointwise_activation)