class_docstr: A single block of the Squeezeformer encoder.
  
  Args:
      d_model (int): input dimension of MultiheadAttentionMechanism and PositionwiseFeedForward
      d_ff (int): hidden dimension of PositionwiseFeedForward
      n_heads (int): number of heads for multi-head attention
      conv_kernel_size (int): kernel size for depthwise convolution in convolution module
      dropout (float): dropout probabilities for linear layers
      dropout_att (float): dropout probabilities for attention distributions
      adaptive_scale (bool): Whether to scale the inputs to each component by affine `scale` and `bias` layer.
          Or use a fixed scale=1 and bias=0.
class_docstr_tok: ["A","single","block","of","the","Squeezeformer","encoder",".","Args",":","d_model","(","int",")",":","input","dimension","of","MultiheadAttentionMechanism","and","PositionwiseFeedForward","d_ff","(","int",")",":","hidden","dimension","of","PositionwiseFeedForward","n_heads","(","int",")",":","number","of","heads","for","multi-head","attention","conv_kernel_size","(","int",")",":","kernel","size","for","depthwise","convolution","in","convolution","module","dropout","(","float",")",":","dropout","probabilities","for","linear","layers","dropout_att","(","float",")",":","dropout","probabilities","for","attention","distributions","adaptive_scale","(","bool",")",":","Whether","to","scale","the","inputs","to","each","component","by","affine","`","scale","`","and","`","bias","`","layer",".","Or","use","a","fixed","scale=1","and","bias=0","."]
code: def __init__(
      self,
      d_model,
      d_ff,
      self_attention_model="rel_pos",
      n_heads=4,
      conv_kernel_size=31,
      conv_norm_type="batch_norm",
      dropout=0.1,
      dropout_att=0.1,
      pos_bias_u=None,
      pos_bias_v=None,
      adaptive_scale: bool = True,
  ):
      super().__init__()
  
      self.self_attention_model = self_attention_model
      self.n_heads = n_heads
      self.fc_factor = 1.0
      self.adaptive_scale = adaptive_scale
  
      # first feed forward module
      self.norm_feed_forward1 = LayerNorm(d_model)
      self.feed_forward1 = ConformerFeedForward(
          d_model=d_model, d_ff=d_ff, dropout=dropout
      )
      self.feed_forward1_scale = ScaleBiasLayer(
          d_model=d_model, adaptive_scale=adaptive_scale
      )
  
      # convolution module
      self.norm_conv = LayerNorm(d_model)
      self.conv = ConformerConvolution(
          d_model=d_model,
          kernel_size=conv_kernel_size,
          norm_type=conv_norm_type,
          pointwise_activation="swish",
      )
      self.conv_scale = ScaleBiasLayer(
          d_model=d_model, adaptive_scale=adaptive_scale
      )
  
      # multi-headed self-attention module
      self.norm_self_att = LayerNorm(d_model)
      if self_attention_model == "rel_pos":
          self.self_attn = RelPositionMultiHeadAttention(
              n_head=n_heads,
              n_feat=d_model,
              dropout_rate=dropout_att,
              pos_bias_u=pos_bias_u,
              pos_bias_v=pos_bias_v,
          )
      elif self_attention_model == "abs_pos":
          self.self_attn = MultiHeadAttention(
              n_head=n_heads, n_feat=d_model, dropout_rate=dropout_att
          )
      else:
          raise ValueError(
              f"'{self_attention_model}' is not not a valid value for 'self_attention_model', "
              f"valid values can be from ['rel_pos', 'abs_pos']"
          )
      self.self_attn_scale = ScaleBiasLayer(
          d_model=d_model, adaptive_scale=adaptive_scale
      )
  
      # second feed forward module
      self.norm_feed_forward2 = LayerNorm(d_model)
      self.feed_forward2 = ConformerFeedForward(
          d_model=d_model, d_ff=d_ff, dropout=dropout
      )
      self.feed_forward2_scale = ScaleBiasLayer(
          d_model=d_model, adaptive_scale=adaptive_scale
      )
  
      self.dropout = nn.Dropout(dropout)
      # self.norm_out = LayerNorm(d_model)
  
      # initialize parameters properly
      self.reset_parameters()
  
imports: import torch
  from torch import nn
  from torch.nn import LayerNorm
  from nemo.collections.asr.parts.submodules.conformer_modules import ConformerConvolution, ConformerFeedForward
  from nemo.collections.asr.parts.submodules.multi_head_attention import MultiHeadAttention, RelPositionMultiHeadAttention
  from nemo.collections.common.parts import adapter_modules
  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 SqueezeformerLayer object from inherited base classes: torch.nn, AdapterModuleMixin, AccessMixin with example: obj = SqueezeformerLayer(d_model, d_ff, _attention_model, n_heads, conv_kernel_size, conv_norm_type, dropout, dropout_att, pos_bias_u, pos_bias_v, adaptive_scale)