class_docstr: Initialize the Lightseq Embedding 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 LSTransformerEmbeddingLayer config, see get_config
  
      initial_embeddings: Optional: Only used for unit test
class_docstr_tok: ["Initialize","the","Lightseq","Embedding","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","LSTransformerEmbeddingLayer","config",",","see","get_config","initial_embeddings",":","Optional",":","Only","used","for","unit","test"]
code: def __init__(
      self,
      config,
      initial_embeddings=None,
      initial_positions=None,
  ):
      super(LSTransformerEmbeddingLayer, self).__init__()
  
      self.config = copy.deepcopy(config)
      self.config.layer_id = LSTransformerEmbeddingLayer.layer_id
      LSTransformerEmbeddingLayer.layer_id = (
          LSTransformerEmbeddingLayer.layer_id + 1
      )
  
      if self.config.local_rank >= 0:
          torch.cuda.set_device(self.config.local_rank)
  
      self.quant_mode = False
  
      self.para_offset = LSTransformerEmbeddingLayer.gen_offset(
          config.embedding_dim, config.vocab_size, config.max_seq_len
      )
      if not config.trainable_pos:
          # only retain the embedding params
          self.para_offset = self.para_offset[:2]
  
      # if trainable_pos is True, deprecate self.pos_embeddings
      self.pos_embeddings = get_pos_embedding(
          self.config.max_seq_len, self.config.embedding_dim
      ).to(self.config.local_rank)
      if self.config.fp16:
          self.pos_embeddings = self.pos_embeddings.to(torch.half)
  
      # create the layer in cuda kernels.
      self.create_cpp_layer()
  
      # declare trainable embedding and position(if needed) parameters
      self.para = nn.Parameter(torch.Tensor(self.para_offset[-1] + 1))
      if initial_embeddings is None and initial_positions is None:
          self.reset_parameters()
          return
  
      embeddings = self._get_weights(0)
      assert embeddings.numel() == initial_embeddings.numel()
      embeddings.copy_(initial_embeddings.view(-1))
      if config.trainable_pos:
          pos_embeddings = self._get_weights(1)
          assert pos_embeddings.numel() == initial_positions.numel()
          pos_embeddings.copy_(initial_positions.view(-1))
  
imports: import copy
  import torch
  from torch import nn
  from torch.autograd import Function
  from lightseq.training.ops.pytorch import TransformerBuilder
  from lightseq.training.ops.pytorch.layer_base import TransformerEmbeddingLayerBase
  from lightseq.training.ops.pytorch.util import copy_para, state_dict, calc_offset, get_pos_embedding
label_desc: Use image node_id 1 to create a new LSTransformerEmbeddingLayer object from inherited base classes: TransformerEmbeddingLayerBase with example: obj = LSTransformerEmbeddingLayer(config, initial_embeddings, initial_positions)