class_docstr: Sparse Embedding for Knowledge Graph
  It is used to store both entity embeddings and relation embeddings.
  
  Parameters
  ----------
  args :
      Global configs.
  num : int
      Number of embeddings.
  dim : int
      Embedding dimention size.
  ctx : mx.ctx
      Device context to store the embedding.
class_docstr_tok: ["Sparse","Embedding","for","Knowledge","Graph","It","is","used","to","store","both","entity","embeddings","and","relation","embeddings",".","Parameters","--","--","--","--","--","args",":","Global","configs",".","num",":","int","Number","of","embeddings",".","dim",":","int","Embedding","dimention","size",".","ctx",":","mx.ctx","Device","context","to","store","the","embedding","."]
docstr: Return sliced tensor.
  
  Parameters
  ----------
  idx : th.tensor
      Slicing index
  gpu_id : int
      Which gpu to put sliced data in.
  trace : bool
      If True, trace the computation. This is required in training.
      If False, do not trace the computation.
      Default: True
docstr_tok: ["Return","sliced","tensor",".","Parameters","--","--","--","--","--","idx",":","th.tensor","Slicing","index","gpu_id",":","int","Which","gpu","to","put","sliced","data","in",".","trace",":","bool","If","True",",","trace","the","computation",".","This","is","required","in","training",".","If","False",",","do","not","trace","the","computation",".","Default",":","True"]
code: def __call__(self, idx, gpu_id=-1, trace=True):
      """Return sliced tensor.
  
      Parameters
      ----------
      idx : th.tensor
          Slicing index
      gpu_id : int
          Which gpu to put sliced data in.
      trace : bool
          If True, trace the computation. This is required in training.
          If False, do not trace the computation.
          Default: True
      """
      if self.emb.context != idx.context:
          idx = idx.as_in_context(self.emb.context)
      data = nd.take(self.emb, idx)
      if gpu_id >= 0:
          data = data.as_in_context(mx.gpu(gpu_id))
      data.attach_grad()
      if trace:
          self.trace.append((idx, data))
      return data
  
imports: import os
  import numpy
  import mxnet
  from mxnet import gluon
  from mxnet import ndarray
  from .score_fun import *
  from ..None import *
label_desc: Use image node_id 4 for calling the ExternalEmbedding obj's underlying member method code with example usage: obj.__call__(idx, gpu_id, trace) and returns: data