class_docstr: RotatE: Knowledge Graph Embedding by Relational Rotation in Complex Space.
  https://arxiv.org/abs/1902.10197
class_docstr_tok: ["RotatE",":","Knowledge","Graph","Embedding","by","Relational","Rotation","in","Complex","Space",".","https",":","\/\/arxiv.org\/abs\/1902.10197"]
code: def __call__(self, head, rel, tail):
      re_head, im_head = paddle.chunk(head, chunks=2, axis=-1)
      re_tail, im_tail = paddle.chunk(tail, chunks=2, axis=-1)
      phase_rel = rel / (self.emb_init / np.pi)
      re_rel, im_rel = paddle.cos(phase_rel), paddle.sin(phase_rel)
  
      re_score = re_rel * re_head - im_rel * im_head
      im_score = re_rel * im_head + im_rel * re_head
      re_score = re_score - re_tail
      im_score = im_score - im_tail
  
      score = paddle.sqrt(
          re_score * re_score + im_score * im_score + self.epsilon
      )
      score = self.gamma - paddle.sum(score, axis=-1)
      return score
  
imports: import math
  import numpy
  from numpy.random import RandomState
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddle.nn.functional import log_sigmoid
label_desc: Use image node_id 2 for calling the RotatEScore obj's underlying member method code with example usage: obj.__call__(head, rel, tail) and returns: score