class_docstr: A single block of the Conformer encoder.
  
  Args:
      d_model (int): input dimension of MultiheadAttentionMechanism and PositionwiseFeedForward
      d_ff (int): hidden dimension of PositionwiseFeedForward
      self_attention_model (str): type of the attention layer and positional encoding
          'rel_pos': relative positional embedding and Transformer-XL
          'rel_pos_local_attn': relative positional embedding and Transformer-XL with local attention using
              overlapping chunks. Attention context is determined by att_context_size parameter.
          'abs_pos': absolute positional embedding and Transformer
          Default is rel_pos.
      global_tokens (int): number of tokens to be used for global attention.
          Only relevant if self_attention_model is 'rel_pos_local_attn'.
          Defaults to 0.
      global_tokens_spacing (int): how far apart the global tokens are
          Defaults to 1.
      global_attn_separate (bool): whether the q, k, v layers used for global tokens should be separate.
          Defaults to False.
      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
class_docstr_tok: ["A","single","block","of","the","Conformer","encoder",".","Args",":","d_model","(","int",")",":","input","dimension","of","MultiheadAttentionMechanism","and","PositionwiseFeedForward","d_ff","(","int",")",":","hidden","dimension","of","PositionwiseFeedForward","self_attention_model","(","str",")",":","type","of","the","attention","layer","and","positional","encoding","'rel_pos","'",":","relative","positional","embedding","and","Transformer-XL","'rel_pos_local_attn","'",":","relative","positional","embedding","and","Transformer-XL","with","local","attention","using","overlapping","chunks",".","Attention","context","is","determined","by","att_context_size","parameter",".","'abs_pos","'",":","absolute","positional","embedding","and","Transformer","Default","is","rel_pos",".","global_tokens","(","int",")",":","number","of","tokens","to","be","used","for","global","attention",".","Only","relevant","if","self_attention_model","is","'rel_pos_local_attn","'",".","Defaults","to","0.","global_tokens_spacing","(","int",")",":","how","far","apart","the","global","tokens","are","Defaults","to","1.","global_attn_separate","(","bool",")",":","whether","the","q",",","k",",","v","layers","used","for","global","tokens","should","be","separate",".","Defaults","to","False",".","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"]
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
      cache_last_channel (torch.tensor) : cache for MHA layers (B, T_cache, d_model)
      cache_last_time (torch.tensor) : cache for convolutional layers (B, d_model, T_cache)
  Returns:
      x (torch.Tensor): (B, T, d_model)
      cache_last_channel (torch.tensor) : next cache for MHA layers (B, T_cache, d_model)
      cache_last_time (torch.tensor) : next cache for convolutional layers (B, d_model, T_cache)
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","cache_last_channel","(","torch.tensor",")",":","cache","for","MHA","layers","(","B",",","T_cache",",","d_model",")","cache_last_time","(","torch.tensor",")",":","cache","for","convolutional","layers","(","B",",","d_model",",","T_cache",")","Returns",":","x","(","torch.Tensor",")",":","(","B",",","T",",","d_model",")","cache_last_channel","(","torch.tensor",")",":","next","cache","for","MHA","layers","(","B",",","T_cache",",","d_model",")","cache_last_time","(","torch.tensor",")",":","next","cache","for","convolutional","layers","(","B",",","d_model",",","T_cache",")"]
code: def forward(
      self,
      x,
      att_mask=None,
      pos_emb=None,
      pad_mask=None,
      cache_last_channel=None,
      cache_last_time=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
          cache_last_channel (torch.tensor) : cache for MHA layers (B, T_cache, d_model)
          cache_last_time (torch.tensor) : cache for convolutional layers (B, d_model, T_cache)
      Returns:
          x (torch.Tensor): (B, T, d_model)
          cache_last_channel (torch.tensor) : next cache for MHA layers (B, T_cache, d_model)
          cache_last_time (torch.tensor) : next cache for convolutional layers (B, d_model, T_cache)
      """
      residual = x
      x = self.norm_feed_forward1(x)
      x = self.feed_forward1(x)
      residual = residual + self.dropout(x) * self.fc_factor
  
      x = self.norm_self_att(residual)
      if self.self_attention_model == "rel_pos":
          x = self.self_attn(
              query=x,
              key=x,
              value=x,
              mask=att_mask,
              pos_emb=pos_emb,
              cache=cache_last_channel,
          )
      elif self.self_attention_model == "rel_pos_local_attn":
          x = self.self_attn(
              query=x,
              key=x,
              value=x,
              pad_mask=pad_mask,
              pos_emb=pos_emb,
              cache=cache_last_channel,
          )
      elif self.self_attention_model == "abs_pos":
          x = self.self_attn(
              query=x,
              key=x,
              value=x,
              mask=att_mask,
              cache=cache_last_channel,
          )
      else:
          x = None
  
      if x is not None and cache_last_channel is not None:
          (x, cache_last_channel) = x
  
      residual = residual + self.dropout(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)
          residual = pack_ip["x"]
  
      x = self.norm_conv(residual)
      x = self.conv(x, pad_mask=pad_mask, cache=cache_last_time)
      if cache_last_time is not None:
          (x, cache_last_time) = x
      residual = residual + self.dropout(x)
  
      x = self.norm_feed_forward2(residual)
      x = self.feed_forward2(x)
      residual = residual + self.dropout(x) * self.fc_factor
  
      x = self.norm_out(residual)
  
      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)
      if cache_last_channel is None:
          return x
      else:
          return x, cache_last_channel, cache_last_time
  
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 2 for calling the ConformerLayer obj's underlying member method code with example usage: obj.forward(x, att_mask, pos_emb, pad_mask, cache_last_channel, cache_last_time) and returns: x, x,  cache_last_channel,  cache_last_time