code: def rep_rotate(
      entity_feat,
      relation_feat,
      entity_neighbors,
      alpha,
      degree_w,
      gamma=10,
      indegrees=None,
      neighbor_norm=False,
  ):
      new_entity_feat = np.zeros(entity_feat.shape, dtype="float32")
  
      hidden_dim = relation_feat.shape[1]
      emb_init = gamma / hidden_dim
  
      for i, efeat in enumerate(entity_feat):
          src_or_dst, r_type, direct = entity_neighbors[i]
          if len(src_or_dst) > 0:
              relation = relation_feat[r_type]
              phase_rel = relation / (emb_init / np.pi)
              re_rel, im_rel = np.cos(phase_rel), np.sin(phase_rel)
  
              head = entity_feat[src_or_dst]
              re_head, im_head = np.split(head, 2, -1)
              re_score = (
                  re_head * re_rel - ((im_head * im_rel).T * direct).T
              )
              im_score = (
                  im_head * re_rel + ((re_head * im_rel).T * direct).T
              )
              src_nfeat_value = np.concatenate([re_score, im_score], -1)
  
              if not neighbor_norm:
                  aggr_nfeat = np.mean(src_nfeat_value, axis=0)
              else:
                  src_indegrees = indegrees[src_or_dst]
                  src_norm = np.power(src_indegrees, degree_w)
                  src_norm = src_norm / np.sum(src_norm)
                  neigh_nfeat = neigh_nfeat * src_norm
                  aggr_nfeat = np.sum(neigh_nfeat, axis=0)
              new_nfeat = efeat * alpha + aggr_nfeat * (1 - alpha)
          else:
              new_nfeat = efeat
          new_entity_feat[i] = new_nfeat
      return new_entity_feat
  
file_path: PGL/apps/Graph4KG/examples/REP/rep.py
imports: import os
  import time
  import logging
  import argparse
  import numpy
  from tqdm import tqdm
  import pgl
  from ote_orth import OrthOTE
label_desc: Use image node_id 5 for calling a global function with example usage: rep_rotate(entity_feat, relation_feat, entity_neighbors, alpha, degree_w, gamma, indegrees, neighbor_norm) and returns: new_entity_feat