class_docstr: RotatE model.
class_docstr_tok: ["RotatE","model","."]
docstr: Score function of RotatE  
docstr_tok: ["Score","function","of","RotatE"]
code: def score_with_l2_normalize(
      self, head, tail, rel, epsilon_var, train_neg_mode
  ):
      """
      Score function of RotatE
      """
      one_var = fluid.layers.fill_constant(
          shape=[1], dtype="float32", value=1.0
      )
      re_head, im_head = fluid.layers.split(
          head, num_or_sections=2, dim=-1
      )
      re_tail, im_tail = fluid.layers.split(
          tail, num_or_sections=2, dim=-1
      )
  
      phase_relation = rel / (
          self._relation_embedding_margin / self._pi
      )
      re_relation = fluid.layers.cos(phase_relation)
      im_relation = fluid.layers.sin(phase_relation)
  
      re_score = re_relation * re_tail + im_relation * im_tail
      im_score = re_relation * im_tail - im_relation * re_tail
      re_score = re_score - re_head
      im_score = im_score - im_head
      # with fluid.layers.control_flow.Switch() as switch:
      #    with switch.case(train_neg_mode == one_var):
      #        re_score = re_relation * re_tail + im_relation * im_tail
      #        im_score = re_relation * im_tail - im_relation * re_tail
      #        re_score = re_score - re_head
      #        im_score = im_score - im_head
      #    with switch.default():
      #        re_score = re_head * re_relation - im_head * im_relation
      #        im_score = re_head * im_relation + im_head * re_relation
      #        re_score = re_score - re_tail
      #        im_score = im_score - im_tail
  
      re_score = re_score * re_score
      im_score = im_score * im_score
  
      score = re_score + im_score
      score = score + epsilon_var
      score = fluid.layers.sqrt(score)
      score = fluid.layers.reduce_sum(score, dim=-1)
      return self._margin - score
  
file_path: PGL/legacy/examples/pgl-ke/model/RotatE.py
imports: import paddle.fluid
  from .Model import Model
  from .utils import lookup_table
label_desc: Use image node_id 4 for calling the RotatE obj's underlying member method code with example usage: obj.score_with_l2_normalize(head, tail, rel, epsilon_var, train_neg_mode) and returns: unknown