class_docstr: Branchformer module definition.
  
  Reference: https://arxiv.org/pdf/2207.02971.pdf
  
  Args:
      block_size: Input/output size.
      linear_size: Linear layers' hidden size.
      self_att: Self-attention module instance.
      conv_mod: Convolution module instance.
      norm_class: Normalization class.
      norm_args: Normalization module arguments.
      dropout_rate: Dropout rate.
docstr: Encode input sequences.
  
  Args:
      x: Branchformer input sequences. (B, T, D_block)
      pos_enc: Positional embedding sequences. (B, 2 * (T - 1), D_block)
      mask: Source mask. (B, T)
      chunk_mask: Chunk mask. (T_2, T_2)
  
  Returns:
      x: Branchformer output sequences. (B, T, D_block)
      mask: Source mask. (B, T)
      pos_enc: Positional embedding sequences. (B, 2 * (T - 1), D_block)
docstr_tok: ["Encode","input","sequences",".","Args",":","x",":","Branchformer","input","sequences",".","(","B",",","T",",","D_block",")","pos_enc",":","Positional","embedding","sequences",".","(","B",",","2","*","(","T","-","1",")",",","D_block",")","mask",":","Source","mask",".","(","B",",","T",")","chunk_mask",":","Chunk","mask",".","(","T_2",",","T_2",")","Returns",":","x",":","Branchformer","output","sequences",".","(","B",",","T",",","D_block",")","mask",":","Source","mask",".","(","B",",","T",")","pos_enc",":","Positional","embedding","sequences",".","(","B",",","2","*","(","T","-","1",")",",","D_block",")"]
code: def forward(
      self,
      x: torch.Tensor,
      pos_enc: torch.Tensor,
      mask: torch.Tensor,
      chunk_mask: Optional[torch.Tensor] = None,
  ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
      """Encode input sequences.
  
      Args:
          x: Branchformer input sequences. (B, T, D_block)
          pos_enc: Positional embedding sequences. (B, 2 * (T - 1), D_block)
          mask: Source mask. (B, T)
          chunk_mask: Chunk mask. (T_2, T_2)
  
      Returns:
          x: Branchformer output sequences. (B, T, D_block)
          mask: Source mask. (B, T)
          pos_enc: Positional embedding sequences. (B, 2 * (T - 1), D_block)
  
      """
      x1 = x
      x2 = x
  
      x1 = self.norm_self_att(x1)
  
      x1 = self.dropout(
          self.self_att(
              x1, x1, x1, pos_enc, mask=mask, chunk_mask=chunk_mask
          )
      )
  
      x2 = self.norm_mlp(x2)
  
      x2 = self.channel_proj1(x2)
      x2, _ = self.conv_mod(x2, mask)
      x2 = self.channel_proj2(x2)
  
      x2 = self.dropout(x2)
  
      x = x + self.dropout(self.merge_proj(torch.cat([x1, x2], dim=-1)))
  
      x = self.norm_final(x)
  
      return x, mask, pos_enc
  
imports: from typing import Dict, Optional, Tuple
  import torch
label_desc: Use image node_id 3 for calling the Branchformer obj's underlying member method code with example usage: obj.forward(x, pos_enc, mask, chunk_mask) and returns: x,  mask,  pos_enc