code: def __init__(self, cfg: D2vDecoderConfig, input_dim):
      super().__init__()
  
      self.input_proj = nn.Linear(input_dim, cfg.decoder_dim)
  
      self.blocks = nn.Sequential(
          *[
              EncDecBlock(
                  q_dim=cfg.decoder_dim,
                  kv_dim=input_dim,
                  num_heads=8,
                  mlp_ratio=4.0,
                  qkv_bias=True,
                  qk_scale=None,
                  drop=0.0,
                  attn_drop=0.0,
                  mlp_drop=0.0,
                  post_mlp_drop=0.0,
                  drop_path=0.0,
                  act_layer=nn.GELU,
                  norm_layer=nn.LayerNorm,
                  layer_norm_first=False,
                  cosine_attention=False,
                  first_residual=i > 0,
              )
              for i in range(cfg.decoder_layers)
          ]
      )
  
      self.proj = nn.Linear(cfg.decoder_dim, input_dim)
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  import numpy
  from dataclasses import dataclass
  from fairseq.modules import LayerNorm, SamePad, SamePad2d, TransposeLast
label_desc: Use image node_id 1 to create a new EncDecTransformerDecoder object from inherited base classes: nn with example: obj = EncDecTransformerDecoder(cfg, input_dim)