code: def __count_htr(self):
      self.h_of_tr = {}
      self.t_of_hr = {}
      self.r_of_ht = {}
      self.h_of_r = {}
      self.t_of_r = {}
      self.freqRel = {}
      self.lef_mean = {}
      self.rig_mean = {}
  
      triples = zip(self.head, self.tail, self.rel)
      for h, t, r in triples:
          if (h, r) not in self.t_of_hr:
              self.t_of_hr[(h, r)] = []
          self.t_of_hr[(h, r)].append(t)
          if (t, r) not in self.h_of_tr:
              self.h_of_tr[(t, r)] = []
          self.h_of_tr[(t, r)].append(h)
          if (h, t) not in self.r_of_ht:
              self.r_of_ht[(h, t)] = []
          self.r_of_ht[(h, t)].append(r)
          if r not in self.freqRel:
              self.freqRel[r] = 0
              self.h_of_r[r] = {}
              self.t_of_r[r] = {}
          self.freqRel[r] += 1.0
          self.h_of_r[r][h] = 1
          self.t_of_r[r][t] = 1
  
      for t, r in self.h_of_tr:
          self.h_of_tr[(t, r)] = np.array(
              list(set(self.h_of_tr[(t, r)]))
          )
      for h, r in self.t_of_hr:
          self.t_of_hr[(h, r)] = np.array(
              list(set(self.t_of_hr[(h, r)]))
          )
      for h, t in self.r_of_ht:
          self.r_of_ht[(h, t)] = np.array(
              list(set(self.r_of_ht[(h, t)]))
          )
      for r in range(self.rel_total):
          self.h_of_r[r] = np.array(list(self.h_of_r[r].keys()))
          self.t_of_r[r] = np.array(list(self.t_of_r[r].keys()))
          self.lef_mean[r] = self.freqRel[r] / len(self.h_of_r[r])
          self.rig_mean[r] = self.freqRel[r] / len(self.t_of_r[r])
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import random
  import numpy
  import torch
  from torch.utils.data import Dataset, DataLoader
label_desc: Use image node_id 5 for calling the PyTorchTrainDataset obj's underlying member method code with example usage: obj.__count_htr() without return types