code: def rep_transe(
      entity_feat,
      relation_feat,
      entity_neighbors,
      alpha,
      degree_w,
      indegrees=None,
      neighbor_norm=False,
  ):
      new_entity_feat = np.zeros(entity_feat.shape, dtype="float32")
      for i, efeat in enumerate(entity_feat):
          src_or_dst, r_type, direct = entity_neighbors[i]
          if len(src_or_dst) > 0:
              src_nfeat_value = entity_feat[src_or_dst]
              neigh_nfeat = (
                  src_nfeat_value + (relation_feat[r_type].T * direct).T
              )
  
              if not neighbor_norm:
                  aggr_nfeat = np.mean(neigh_nfeat, 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 4 for calling a global function with example usage: rep_transe(entity_feat, relation_feat, entity_neighbors, alpha, degree_w, indegrees, neighbor_norm) and returns: new_entity_feat