class_docstr: Initialize the Lightseq Cross Entropy Layer.
  
  Static variable:
      layer_id: The layer-index counter starting from 0 and incrementing by 1 every time a layer object is instantiated,
  Arguments:
      config: An object of LSCrossEntropyLayer config, see get_config
code: def __init__(
      self,
      config,
  ):
      super(LSCrossEntropyLayer, self).__init__()
      self.config = config
      self.config.layer_id = LSCrossEntropyLayer.layer_id
      LSCrossEntropyLayer.layer_id += 1
  
      if self.config.local_rank >= 0:
          torch.cuda.set_device(self.config.local_rank)
  
      # Load cuda modules if needed
      global transformer_cuda_module
      if transformer_cuda_module is None:
          transformer_cuda_module = TransformerBuilder().load()
  
      # create the layer in cuda kernels.
      cuda_module = transformer_cuda_module
      create_layer_func = (
          cuda_module.create_cross_entropy_layer_fp16
          if self.config.fp16
          else cuda_module.create_cross_entropy_layer_fp32
      )
  
      create_layer_func(
          self.config.layer_id,
          self.config.epsilon,
          self.config.padding_idx,
          self.config.max_batch_tokens,
      )
  
file_path: lightseq/lightseq/training/ops/pytorch/cross_entropy_layer.py
imports: from dataclasses import dataclass
  import torch
  from torch import nn
  from torch.autograd import Function
  from lightseq.training.ops.pytorch.builder import TransformerBuilder
label_desc: Use image node_id 1 to create a new LSCrossEntropyLayer object from inherited base classes: nn with example: obj = LSCrossEntropyLayer(config)