class_docstr: Calculate simularity of entity/relation embeddings based on pretained KG embeddings
  Parameters
  ---------
  device : int
      Device to run the inference, -1 for CPU
  emb_file : dict
      Containing embedding information
  sfunc : str
      What kind of score is used,
          cosine: score = $rac{x \cdot y}{||x||_2||y||_2}$
          l2: score = $-||x - y||_2$
          l1: score = $-||x - y||_1$
          dot: score = $x \cdot y$
          ext_jaccard: score = $rac{x \cdot y}{||x||_{2}^{2} + ||y||_{2}^{2} - x \cdot y}$
class_docstr_tok: ["Calculate","simularity","of","entity\/relation","embeddings","based","on","pretained","KG","embeddings","Parameters","--","--","--","--","-","device",":","int","Device","to","run","the","inference",",","-1","for","CPU","emb_file",":","dict","Containing","embedding","information","sfunc",":","str","What","kind","of","score","is","used",",","cosine",":","score","=","$","rac","{","x","\\cdot","y","}","{","||x||_2||y||_2","}","$","l2",":","score","=","$","-||x","-","y||_2","$","l1",":","score","=","$","-||x","-","y||_1","$","dot",":","score","=","$","x","\\cdot","y","$","ext_jaccard",":","score","=","$","rac","{","x","\\cdot","y","}","{","||x||_","{","2","}","^","{","2","}","+","||y||_","{","2","}","^","{","2","}","-","x","\\cdot","y","}","$"]
code: def __init__(
      self,
      device,
      emb_file,
      sfunc="cosine",
      batch_size=DEFAULT_INFER_BATCHSIZE,
  ):
      self.device = get_dev(device)
      self.emb_file = emb_file
      self.sfunc = sfunc
      if sfunc == "cosine":
          self.sim_func = cosine_dist
      elif sfunc == "l2":
          self.sim_func = l2_dist
      elif sfunc == "l1":
          self.sim_func = l1_dist
      elif sfunc == "dot":
          self.sim_func = dot_dist
      elif sfunc == "ext_jaccard":
          self.sim_func = extended_jaccard_dist
      self.batch_size = batch_size
  
file_path: ogb/examples/lsc/wikikg90m/dgl-ke-ogb-lsc/python/dglke/models/infer.py
imports: import os
  import time
  import argparse
  import numpy
  import dgl.backend
  from .general_models import InferModel
label_desc: Use image node_id 1 to create a new EmbSimInfer object  with example: obj = EmbSimInfer(device, emb_file, sfunc, batch_size)