code: def get_h2t_t2h_feat(t_candidate, hr, path):
      h2t_t2h_feat = np.zeros(t_candidate.shape, dtype=np.float16)
      for i in tqdm(range(t_candidate.shape[0])):
          h = hr[i, 0]
          if h not in h2t_prob:
              continue
          for j in range(t_candidate.shape[1]):
              tail = t_candidate[i, j]
              if tail not in h2t_prob:
                  continue
              for e in h2t_prob[h]:
                  if e not in h2t_prob[tail]:
                      continue
                  prob = h2t_prob[h][e] * t2h_prob[e][tail]
                  h2t_t2h_feat[i][j] += prob
      np.save(path, h2t_t2h_feat)
      return h2t_t2h_feat
  
file_path: PGL/examples/kddcup2021/WikiKG90M/feature/dump_feat/2_h2t_t2h_feat.py
imports: from __future__ import division
  from __future__ import absolute_import
  from __future__ import print_function
  from __future__ import unicode_literals
  import sys
  import argparse
  import logging
  import numpy
  import pickle
  from tqdm import tqdm
  import math
  from multiprocessing import Pool
label_desc: Use image node_id 1 for calling a global function with example usage: get_h2t_t2h_feat(t_candidate, hr, path) and returns: h2t_t2h_feat