code: def __init__(
      self,
      in_path=None,
      tri_file=None,
      ent_file=None,
      rel_file=None,
      batch_size=None,
      nbatches=None,
      threads=8,
      sampling_mode="normal",
      bern_flag=False,
      filter_flag=True,
      neg_ent=1,
      neg_rel=0,
      shuffle=True,
      drop_last=True,
  ):
      self.in_path = in_path
      self.tri_file = tri_file
      self.ent_file = ent_file
      self.rel_file = rel_file
      if in_path != None:
          self.tri_file = in_path + "train2id.txt"
          self.ent_file = in_path + "entity2id.txt"
          self.rel_file = in_path + "relation2id.txt"
  
      dataset = self.__construct_dataset(
          sampling_mode, bern_flag, filter_flag, neg_ent, neg_rel
      )
  
      self.batch_size = batch_size
      self.nbatches = nbatches
      if batch_size == None:
          self.batch_size = dataset.get_tri_tot() // nbatches
      if nbatches == None:
          self.nbatches = dataset.get_tri_tot() // batch_size
  
      super(PyTorchTrainDataLoader, self).__init__(
          dataset=dataset,
          batch_size=self.batch_size,
          shuffle=shuffle,
          pin_memory=True,
          num_workers=threads,
          collate_fn=dataset.collate_fn,
          drop_last=drop_last,
      )
  
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 1 to create a new PyTorchTrainDataLoader object from inherited base classes: DataLoader with example: obj = PyTorchTrainDataLoader(in_path, tri_file, ent_file, rel_file, batch_size, nbatches, threads, sampling_mode, bern_flag, filter_flag, neg_ent, neg_rel, shuffle, drop_last)