class_docstr: A vanilla Transformer Decoder block
  
  ... note: this implementation is not (yet ?) reversible
class_docstr_tok: ["A","vanilla","Transformer","Decoder","block","...","note",":","this","implementation","is","not","(","yet","?",")","reversible"]
code: def forward(
      self,
      target: torch.Tensor,
      memory: torch.Tensor,
      encoder_att_mask: Optional[
          Union[torch.Tensor, AttentionMask]
      ] = None,
      decoder_att_mask: Optional[
          Union[torch.Tensor, AttentionMask]
      ] = None,
      input_mask: Optional[torch.Tensor] = None,
  ):
      if self.pose_encoding is not None:
          target = self.pose_encoding(target)
  
          if hasattr(self, "embedding_projector"):
              target = self.embedding_projector(target)
  
      # Handle the optional input masking, differs on Q, K, V
      if input_mask is not None:
          target_q = target
          target_k = target * input_mask.unsqueeze(-1)
          target_v = target_k
      else:
          target_q, target_k, target_v = target, target, target
  
      x = self.wrap_att(
          inputs=[target_q, target_k, target_v],
          att_mask=decoder_att_mask,
      )
      x = self.wrap_cross(
          inputs=[x, memory, memory], att_mask=encoder_att_mask
      )
      x = self.wrap_ff(inputs=[x])
  
      return x
  
imports: import logging
  from dataclasses import asdict
  from typing import Optional, Tuple, Union
  import torch
  import torch.nn
  from xformers._deprecation_warning import deprecated_function
  from xformers.components import PatchEmbeddingConfig, PostNorm, PreNorm, Residual, ResidualNormStyle, build_multi_head_attention, build_patch_embedding
  from xformers.components.attention import AttentionMask
  from xformers.components.feedforward import build_feedforward
  from xformers.components.positional_embedding import build_positional_embedding
  from xformers.components.residual import get_deepnorm_coefficients
  from xformers.components.simplicial_embedding import SimplicialEmbedding
  from xformers.factory.block_configs import NormalizationType, xFormerDecoderConfig, xFormerEncoderConfig
label_desc: Use image node_id 3 for calling the xFormerDecoderBlock obj's underlying member method code with example usage: obj.forward(target, memory, encoder_att_mask, decoder_att_mask, input_mask) and returns: x