class_docstr: E-Branchformer module definition.
  
  Reference: https://arxiv.org/pdf/2210.00077.pdf
  
  Args:
      block_size: Input/output size.
      linear_size: Linear layers' hidden size.
      self_att: Self-attention module instance.
      feed_forward: Feed-forward module instance.
      feed_forward_macaron: Feed-forward module instance for macaron network.
      conv_mod: ConvolutionalSpatialGatingUnit module instance.
      depthwise_conv_mod: DepthwiseConvolution module instance.
      norm_class: Normalization class.
      norm_args: Normalization module arguments.
      dropout_rate: Dropout rate.
docstr: Encode chunk of input sequence.
  
  Args:
      x: E-Branchformer input sequences. (B, T, D_block)
      pos_enc: Positional embedding sequences. (B, 2 * (T - 1), D_block)
      mask: Source mask. (B, T_2)
      left_context: Number of previous frames the attention module can see
                    in current chunk.
  
  Returns:
      x: E-Branchformer output sequences. (B, T, D_block)
      pos_enc: Positional embedding sequences. (B, 2 * (T - 1), D_block)
docstr_tok: ["Encode","chunk","of","input","sequence",".","Args",":","x",":","E-Branchformer","input","sequences",".","(","B",",","T",",","D_block",")","pos_enc",":","Positional","embedding","sequences",".","(","B",",","2","*","(","T","-","1",")",",","D_block",")","mask",":","Source","mask",".","(","B",",","T_2",")","left_context",":","Number","of","previous","frames","the","attention","module","can","see","in","current","chunk",".","Returns",":","x",":","E-Branchformer","output","sequences",".","(","B",",","T",",","D_block",")","pos_enc",":","Positional","embedding","sequences",".","(","B",",","2","*","(","T","-","1",")",",","D_block",")"]
code: def chunk_forward(
      self,
      x: torch.Tensor,
      pos_enc: torch.Tensor,
      mask: torch.Tensor,
      left_context: int = 0,
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      """Encode chunk of input sequence.
  
      Args:
          x: E-Branchformer input sequences. (B, T, D_block)
          pos_enc: Positional embedding sequences. (B, 2 * (T - 1), D_block)
          mask: Source mask. (B, T_2)
          left_context: Number of previous frames the attention module can see
                        in current chunk.
  
      Returns:
          x: E-Branchformer output sequences. (B, T, D_block)
          pos_enc: Positional embedding sequences. (B, 2 * (T - 1), D_block)
  
      """
      residual = x
  
      x = self.norm_feed_forward_macaron(x)
      x = (
          residual
          + self.feed_forward_scale * self.feed_forward_macaron(x)
      )
  
      x1 = x
      x2 = x
  
      x1 = self.norm_self_att(x1)
  
      if left_context > 0:
          key = torch.cat([self.cache[0], x1], dim=1)
      else:
          key = x1
      att_cache = key[:, -left_context:, :]
  
      x1 = self.self_att(
          x1, key, key, pos_enc, mask=mask, left_context=left_context
      )
  
      x2 = self.norm_mlp(x2)
  
      x2 = self.channel_proj1(x2)
      x2, conv_cache = self.conv_mod(x2, cache=self.cache[1])
      x2 = self.channel_proj2(x2)
  
      x_concat = torch.cat([x1, x2], dim=-1)
      x_depth, merge_cache = self.depthwise_conv_mod(
          x_concat, cache=self.cache[2]
      )
  
      x = x + self.merge_proj(x_concat + x_depth)
  
      residual = x
  
      x = self.norm_feed_forward(x)
      x = residual + self.feed_forward_scale * self.feed_forward(x)
  
      x = self.norm_final(x)
  
      self.cache = [att_cache, conv_cache, merge_cache]
  
      return x, pos_enc
  
imports: from typing import Dict, Optional, Tuple
  import torch
label_desc: Use image node_id 4 for calling the EBranchformer obj's underlying member method code with example usage: obj.chunk_forward(x, pos_enc, mask, left_context) and returns: x,  pos_enc