class_docstr: Contexutal Block Encoder layer module.
  
  Args:
      size (int): Input dimension.
      self_attn (torch.nn.Module): Self-attention module instance.
          `MultiHeadedAttention` or `RelPositionMultiHeadedAttention` instance
          can be used as the argument.
      feed_forward (torch.nn.Module): Feed-forward module instance.
          `PositionwiseFeedForward`, `MultiLayeredConv1d`, or `Conv1dLinear` instance
          can be used as the argument.
      feed_forward_macaron (torch.nn.Module): Additional feed-forward module instance.
          `PositionwiseFeedForward`, `MultiLayeredConv1d`, or `Conv1dLinear` instance
          can be used as the argument.
      conv_module (torch.nn.Module): Convolution module instance.
          `ConvlutionModule` instance can be used as the argument.
      dropout_rate (float): Dropout rate.
      total_layer_num (int): Total number of layers
      normalize_before (bool): Whether to use layer_norm before the first block.
      concat_after (bool): Whether to concat attention layer's input and output.
          if True, additional linear will be applied.
          i.e. x -> x + linear(concat(x, att(x)))
          if False, no additional linear will be applied. i.e. x -> x + att(x)
docstr: Construct an EncoderLayer object.
code: def __init__(
      self,
      size,
      self_attn,
      feed_forward,
      feed_forward_macaron,
      conv_module,
      dropout_rate,
      total_layer_num,
      normalize_before=True,
      concat_after=False,
  ):
      """Construct an EncoderLayer object."""
      super(ContextualBlockEncoderLayer, self).__init__()
      self.self_attn = self_attn
      self.feed_forward = feed_forward
      self.feed_forward_macaron = feed_forward_macaron
      self.conv_module = conv_module
      self.norm1 = LayerNorm(size)
      self.norm2 = LayerNorm(size)
      if feed_forward_macaron is not None:
          self.norm_ff_macaron = LayerNorm(size)
          self.ff_scale = 0.5
      else:
          self.ff_scale = 1.0
      if self.conv_module is not None:
          self.norm_conv = LayerNorm(size)  # for the CNN module
          self.norm_final = LayerNorm(
              size
          )  # for the final output of the block
      self.dropout = nn.Dropout(dropout_rate)
      self.size = size
      self.normalize_before = normalize_before
      self.concat_after = concat_after
      self.total_layer_num = total_layer_num
      if self.concat_after:
          self.concat_linear = nn.Linear(size + size, size)
  
file_path: espnet/espnet/nets/pytorch_backend/conformer/contextual_block_encoder_layer.py
imports: import torch
  from torch import nn
  from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm
label_desc: Use image node_id 1 to create a new ContextualBlockEncoderLayer object from inherited base classes: nn with example: obj = ContextualBlockEncoderLayer(size, _attn, feed_forward, feed_forward_macaron, conv_module, dropout_rate, total_layer_num, normalize_before, concat_after)