code: def __construct_dataset(
      self, sampling_mode, bern_flag, filter_flag, neg_ent, neg_rel
  ):
      f = open(self.ent_file, "r")
      ent_total = (int)(f.readline())
      f.close()
  
      f = open(self.rel_file, "r")
      rel_total = (int)(f.readline())
      f.close()
  
      head = []
      tail = []
      rel = []
  
      f = open(self.tri_file, "r")
      triples_total = (int)(f.readline())
      for index in range(triples_total):
          h, t, r = f.readline().strip().split()
          head.append((int)(h))
          tail.append((int)(t))
          rel.append((int)(r))
      f.close()
  
      dataset = PyTorchTrainDataset(
          np.array(head),
          np.array(tail),
          np.array(rel),
          ent_total,
          rel_total,
          sampling_mode,
          bern_flag,
          filter_flag,
          neg_ent,
          neg_rel,
      )
      return dataset
  
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 2 for calling the PyTorchTrainDataLoader obj's underlying member method code with example usage: obj.__construct_dataset(sampling_mode, bern_flag, filter_flag, neg_ent, neg_rel) and returns: dataset