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","."]
docstr: Args:
      x (torch.Tensor): input signals (B, T, d_model)
      att_mask (torch.Tensor): attention masks(B, T, T)
      pos_emb (torch.Tensor): (L, 1, d_model)
      pad_mask (torch.tensor): padding mask
  Returns:
      x (torch.Tensor): (B, T, d_model)
docstr_tok: ["Args",":","x","(","torch.Tensor",")",":","input","signals","(","B",",","T",",","d_model",")","att_mask","(","torch.Tensor",")",":","attention","masks","(","B",",","T",",","T",")","pos_emb","(","torch.Tensor",")",":","(","L",",","1",",","d_model",")","pad_mask","(","torch.tensor",")",":","padding","mask","Returns",":","x","(","torch.Tensor",")",":","(","B",",","T",",","d_model",")"]
code: def forward(self, x, att_mask=None, pos_emb=None, pad_mask=None):
      """
      Args:
          x (torch.Tensor): input signals (B, T, d_model)
          att_mask (torch.Tensor): attention masks(B, T, T)
          pos_emb (torch.Tensor): (L, 1, d_model)
          pad_mask (torch.tensor): padding mask
      Returns:
          x (torch.Tensor): (B, T, d_model)
      """
      residual = x
  
      x = self.self_attn_scale(x)
      if self.self_attention_model == "rel_pos":
          x = self.self_attn(
              query=x, key=x, value=x, mask=att_mask, pos_emb=pos_emb
          )
      elif self.self_attention_model == "abs_pos":
          x = self.self_attn(query=x, key=x, value=x, mask=att_mask)
      else:
          x = None
      x = residual + self.dropout(x)
      x = self.norm_self_att(x)
      residual = x
  
      if self.is_adapter_available():
          # Call the MHA adapters
          pack_ip = {
              "x": residual,
              "loc": "mha",
              "att_mask": att_mask,
              "pos_emb": pos_emb,
          }
          pack_ip = self.forward_enabled_adapters(pack_ip)
          x = pack_ip["x"]
  
      x = self.feed_forward1_scale(x)
      x = self.feed_forward1(x)
      x = residual + self.dropout(x) * self.fc_factor
      x = self.norm_feed_forward1(x)
      residual = x
  
      x = self.conv_scale(x)
      x = self.conv(x, pad_mask)
      x = residual + self.dropout(x)
      x = self.norm_conv(x)
      residual = x
  
      x = self.feed_forward2_scale(x)
      x = self.feed_forward2(x)
      x = residual + self.dropout(x) * self.fc_factor
      x = self.norm_feed_forward2(x)
  
      if self.is_adapter_available():
          # Call the adapters
          pack_ip = {
              "x": x,
              "loc": "post",
          }
          pack_ip = self.forward_enabled_adapters(pack_ip)
          x = pack_ip["x"]
  
      if self.is_access_enabled() and self.access_cfg.get(
          "save_encoder_tensors", False
      ):
          self.register_accessible_tensor(name="encoder", tensor=x)
  
      return x
  
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 2 for calling the SqueezeformerLayer obj's underlying member method code with example usage: obj.forward(x, att_mask, pos_emb, pad_mask) and returns: x