class_docstr: This class implements the self-attention decoder layer.
  Arguments
  ----------
  d_ffn : int
      Hidden size of self-attention Feed Forward layer.
  nhead : int
      Number of attention heads.
  d_model : int
      Dimension of the model.
  kdim : int
      Dimension for key (optional).
  vdim : int
      Dimension for value (optional).
  dropout : float
      Dropout for the decoder (optional).
  Example
  -------
  >>> src = torch.rand((8, 60, 512))
  >>> tgt = torch.rand((8, 60, 512))
  >>> net = TransformerDecoderLayer(1024, 8, d_model=512)
  >>> output, self_attn, multihead_attn = net(src, tgt)
  >>> output.shape
  torch.Size([8, 60, 512])
code: def __init__(
      self,
      d_ffn,
      nhead,
      d_model,
      kdim=None,
      vdim=None,
      dropout=0.0,
      activation=nn.ReLU,
      normalize_before=False,
      attention_type="regularMHA",
      causal=None,
  ):
      super().__init__()
      self.nhead = nhead
  
      if attention_type == "regularMHA":
          self.self_attn = sb.nnet.attention.MultiheadAttention(
              nhead=nhead,
              d_model=d_model,
              kdim=kdim,
              vdim=vdim,
              dropout=dropout,
          )
          self.mutihead_attn = sb.nnet.attention.MultiheadAttention(
              nhead=nhead,
              d_model=d_model,
              kdim=kdim,
              vdim=vdim,
              dropout=dropout,
          )
  
      elif attention_type == "RelPosMHAXL":
          self.self_attn = sb.nnet.attention.RelPosMHAXL(
              d_model, nhead, dropout, mask_pos_future=causal
          )
          self.mutihead_attn = sb.nnet.attention.RelPosMHAXL(
              d_model, nhead, dropout, mask_pos_future=causal
          )
  
      self.pos_ffn = sb.nnet.attention.PositionalwiseFeedForward(
          d_ffn=d_ffn,
          input_size=d_model,
          dropout=dropout,
          activation=activation,
      )
  
      # normalization layers
      self.norm1 = sb.nnet.normalization.LayerNorm(d_model, eps=1e-6)
      self.norm2 = sb.nnet.normalization.LayerNorm(d_model, eps=1e-6)
      self.norm3 = sb.nnet.normalization.LayerNorm(d_model, eps=1e-6)
      self.dropout1 = torch.nn.Dropout(dropout)
      self.dropout2 = torch.nn.Dropout(dropout)
      self.dropout3 = torch.nn.Dropout(dropout)
  
      self.normalize_before = normalize_before
  
imports: import math
  import torch
  import torch.nn
  import speechbrain
  from typing import Optional
  import numpy
  from .Conformer import ConformerEncoder
  from .Branchformer import BranchformerEncoder
  from speechbrain.nnet.activations import Swish
  from speechbrain.nnet.attention import RelPosEncXL
  from speechbrain.nnet.CNN import Conv1d
label_desc: Use image node_id 1 to create a new TransformerDecoderLayer object from inherited base classes: nn with example: obj = TransformerDecoderLayer(d_ffn, nhead, d_model, kdim, vdim, dropout, activation, normalize_before, attention_type, causal)