code: def test_quant_decoder_layer_forward():
      batch_size, enc_seq_len = kt.bs_sl()
      _, dec_seq_len = kt.bs_sl(batch_size)
      print(
          f"(batch_size, enc_seq_len, dec_seq_len): ({batch_size}, {enc_seq_len},"
          f" {dec_seq_len})"
      )
  
      for i in range(NUM_LAYERS):
          custom_dec_layer_list[i].apply(enable_quant)
          fairseq_dec_layer_list[i].apply(enable_quant)
  
      hidden_states = kt.rand((batch_size, dec_seq_len, 1024))
      encoder_out = kt.rand((enc_seq_len, batch_size, 1024))
      incremental_state = None
      encoder_padding_mask = kt.attn_mask(
          batch_size, enc_seq_len, dtype=torch.bool
      )
      self_attn_mask = kt.dec_self_attn_mask(dec_seq_len) * -1e8
  
      def custom():
          res = hidden_states.clone()
          for i in range(NUM_LAYERS):
              res, _, _ = custom_dec_layer_list[i](
                  res,
                  encoder_out=encoder_out,
                  encoder_padding_mask=encoder_padding_mask,
                  incremental_state=incremental_state,
              )
          return [
              res.contiguous().detach(),
          ]
  
      def baseline():
          res = hidden_states.clone()
          for i in range(NUM_LAYERS):
              res, _, _ = fairseq_dec_layer_list[i](
                  res,
                  encoder_out=encoder_out,
                  encoder_padding_mask=encoder_padding_mask,
                  self_attn_mask=self_attn_mask,
                  incremental_state=incremental_state,
              )
          return [
              res.contiguous().detach(),
          ]
  
      return custom, baseline
  
imports: import random
  import math
  from copy import deepcopy
  from dataclasses import dataclass
  import torch
  import torch.nn
  from tests.util import TestDecorator, get_fairseq_enc_params, get_fairseq_dec_params, max_batch_tokens, max_seq_len, split_custom_layer_grad, copy_grad_from_paras, copy_cmax_grad_from_paras
  from tests import fairseq_layers
  from lightseq.training.ops.pytorch.transformer_encoder_layer import LSTransformerEncoderLayer
  from lightseq.training.ops.pytorch.transformer_embedding_layer import LSTransformerEmbeddingLayer
  from lightseq.training.ops.pytorch.cross_entropy_layer import LSCrossEntropyLayer
  from lightseq.training.ops.pytorch.quant_linear_layer import LSQuantLinearLayer
  from lightseq.training.cli.fs_modules.ls_fs_transformer_decoder_layer import LSFSTransformerDecoderLayer
  from lightseq.training.ops.pytorch.quantization import enable_quant, disable_quant, qat_mode, ptq_mode
label_desc: Use image node_id 18 for calling a global function with example usage: test_quant_decoder_layer_forward() and returns: custom,  baseline, list, list