code: def test_cross_entropy_layer_forward():
      batch_size, seq_len = kt.bs_sl()
      vocab_size = random.randint(30413, 40519)
      print(
          f"(batch_size, seq_len, vocab_size): ({batch_size}, {seq_len}, {vocab_size})"
      )
  
      inputs = kt.rand((batch_size, seq_len, vocab_size))
      targets = kt.randint(
          ce_config_fp16.padding_idx - 1,
          vocab_size,
          (batch_size, seq_len),
      )
      targets_32 = targets.to(torch.int32)
  
      if kt.dtype == torch.float:
          custom_layer = custom_cross_entropy_layer_fp32
      else:
          custom_layer = custom_cross_entropy_layer_fp16
  
      def custom():
          res, cus_nll_loss = custom_layer(inputs, targets_32)
          res = res.to(inputs)
          cus_nll_loss = cus_nll_loss.to(inputs)
          return [
              res.contiguous().detach(),
              cus_nll_loss.contiguous().detach(),
          ]
  
      def baseline():
          x = torch.nn.functional.log_softmax(
              inputs, dim=-1, dtype=torch.float32
          )
          x, base_nll_loss = label_smoothed_nll_loss(
              x,
              targets,
              ce_config_fp16.epsilon,
              ignore_index=ce_config_fp16.padding_idx,
          )
          x = x.to(inputs)
          base_nll_loss = base_nll_loss.to(inputs)
          return [
              x.contiguous().detach(),
              base_nll_loss.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 29 for calling a global function with example usage: test_cross_entropy_layer_forward() and returns: custom,  baseline, list, list