code: def RotatE(self, head, relation, tail, mode):
      pi = 3.14159265358979323846
  
      re_head, im_head = torch.chunk(head, 2, dim=2)
      re_tail, im_tail = torch.chunk(tail, 2, dim=2)
  
      # Make phases of relations uniformly distributed in [-pi, pi]
  
      phase_relation = relation / (self.embedding_range.item() / pi)
  
      re_relation = torch.cos(phase_relation)
      im_relation = torch.sin(phase_relation)
  
      if mode == "head-batch":
          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
      else:
          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
  
      score = torch.stack([re_score, im_score], dim=0)
      score = score.norm(dim=0)
  
      score = self.gamma.item() - score.sum(dim=2)
      return score
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import logging
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.utils.data import DataLoader
  from dataloader import TestDataset
  from collections import defaultdict
  from ogb.linkproppred import Evaluator
label_desc: Use image node_id 6 for calling the KGEModel obj's underlying member method code with example usage: obj.RotatE(head, relation, tail, mode) and returns: score