class_docstr: Sparse Embedding for Knowledge Graph
  It is used to store both entity embeddings and relation embeddings.
  
  Parameters
  ----------
  num : int
      Number of embeddings.
  dim : int
      Embedding dimention size.
  device : th.device
      Device to store the embedding.
class_docstr_tok: ["Sparse","Embedding","for","Knowledge","Graph","It","is","used","to","store","both","entity","embeddings","and","relation","embeddings",".","Parameters","--","--","--","--","--","num",":","int","Number","of","embeddings",".","dim",":","int","Embedding","dimention","size",".","device",":","th.device","Device","to","store","the","embedding","."]
docstr: Initializing the embeddings for training.
  
  Parameters
  ----------
  emb_init : float
      The intial embedding range should be [-emb_init, emb_init].
docstr_tok: ["Initializing","the","embeddings","for","training",".","Parameters","--","--","--","--","--","emb_init",":","float","The","intial","embedding","range","should","be","[","-emb_init",",","emb_init","]","."]
code: def init(self, emb_init, lr, async_threads, num=-1, dim=-1):
      """Initializing the embeddings for training.
  
      Parameters
      ----------
      emb_init : float
          The intial embedding range should be [-emb_init, emb_init].
      """
      if self.emb is None:
          self.emb = th.empty(
              num, dim, dtype=th.float32, device=self.device
          )
      else:
          self.num = self.emb.shape[0]
          self.dim = self.emb.shape[1]
      self.state_sum = self.emb.new().resize_(self.emb.size(0)).zero_()
      self.trace = []
      self.state_step = 0
      self.has_cross_rel = False
      self.lr = lr
  
      INIT.uniform_(self.emb, -emb_init, emb_init)
      INIT.zeros_(self.state_sum)
  
imports: import os
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.nn.init
  import torch.multiprocessing
  from torch.multiprocessing import Queue
  from _thread import start_new_thread
  import traceback
  from functools import wraps
  from ..None import *
  from .tensor_models import thread_wrapped_func
label_desc: Use image node_id 2 for calling the KGEmbedding obj's underlying member method code with example usage: obj.init(emb_init, lr, async_threads, num, dim) without return types