class_docstr: Decoder layer block augmented with an additional cross-attention.
  
  This decoder block is processed with the sequence of the following sub-modules.
      self-attention -> cross-attention (first) -> cross-attention (second) -> FFN
  
  Args:
      cfg (argparse.Namespace): parsed command-line arguments
      encoder_attn_merge_type (str, optional): the way to combine outputs from
          two cross-attention modules. If "sequential" is set, two cross-attention
          modules are stacked sequentially. If "parallel" is set, they are processed
          in parallel and combined before feeding it to FFN (default: sequential).
      dropnet_ratio (float, optional): a probability to drop each cross-attention
          module during training (default: 0.0).
class_docstr_tok: ["Decoder","layer","block","augmented","with","an","additional","cross-attention",".","This","decoder","block","is","processed","with","the","sequence","of","the","following","sub-modules",".","self-attention","-",">","cross-attention","(","first",")","-",">","cross-attention","(","second",")","-",">","FFN","Args",":","cfg","(","argparse.Namespace",")",":","parsed","command-line","arguments","encoder_attn_merge_type","(","str",",","optional",")",":","the","way","to","combine","outputs","from","two","cross-attention","modules",".","If","``","sequential","''","is","set",",","two","cross-attention","modules","are","stacked","sequentially",".","If","``","parallel","''","is","set",",","they","are","processed","in","parallel","and","combined","before","feeding","it","to","FFN","(","default",":","sequential",")",".","dropnet_ratio","(","float",",","optional",")",":","a","probability","to","drop","each","cross-attention","module","during","training","(","default",":","0.0",")","."]
code: def __init__(
      self,
      cfg,
      add_bias_kv=False,
      add_zero_attn=False,
      encoder_attn_merge_type="sequential",
      dropnet_ratio=0.0,
  ):
      super().__init__(
          cfg,
          no_encoder_attn=False,
          add_bias_kv=add_bias_kv,
          add_zero_attn=False,
      )
      self.encoder_attn = self.build_encoder_attention(
          self.embed_dim, cfg
      )
      self.encoder_attn_layer_norm = LayerNorm(
          self.embed_dim, export=cfg.export
      )
      self.encoder_attn2 = self.build_encoder_attention(
          self.embed_dim, cfg
      )
      if encoder_attn_merge_type == "sequential":
          self.encoder_attn_layer_norm2 = LayerNorm(
              self.embed_dim, export=cfg.export
          )
      else:
          self.encoder_attn_layer_norm2 = None
  
      self.encoder_attn_merge_type = encoder_attn_merge_type
      self.dropnet_ratio = dropnet_ratio
  
file_path: fairseq/fairseq/modules/transformer_layer_aug.py
imports: from typing import Dict, List, Optional
  import torch
  from numpy.random import uniform
  from torch import Tensor
  from fairseq.modules import LayerNorm
  from fairseq.modules.transformer_layer import TransformerDecoderLayerBase
label_desc: Use image node_id 1 to create a new AugTransformerDecoderLayerBase object from inherited base classes: TransformerDecoderLayerBase with example: obj = AugTransformerDecoderLayerBase(cfg, add_bias_kv, add_zero_attn, encoder_attn_merge_type, dropnet_ratio)