code: def __getitem__(self, idx):
      head, relation, tail = (
          self.triples["head"][idx],
          self.triples["relation"][idx],
          self.triples["tail"][idx],
      )
      positive_sample = [head, relation, tail]
  
      subsampling_weight = (
          self.count[(head, relation)]
          + self.count[(tail, -relation - 1)]
      )
      subsampling_weight = torch.sqrt(
          1 / torch.Tensor([subsampling_weight])
      )
  
      # negative_sample_list = []
      # negative_sample_size = 0
  
      # while negative_sample_size < self.negative_sample_size:
      #     negative_sample = np.random.randint(self.nentity, size=self.negative_sample_size*2)
      #     if self.mode == 'head-batch':
      #         mask = np.in1d(
      #             negative_sample,
      #             self.true_head[(relation, tail)],
      #             assume_unique=True,
      #             invert=True
      #         )
      #     elif self.mode == 'tail-batch':
      #         mask = np.in1d(
      #             negative_sample,
      #             self.true_tail[(head, relation)],
      #             assume_unique=True,
      #             invert=True
      #         )
      #     else:
      #         raise ValueError('Training batch mode %s not supported' % self.mode)
      #     negative_sample = negative_sample[mask]
      #     negative_sample_list.append(negative_sample)
      #     negative_sample_size += negative_sample.size
  
      # negative_sample = np.concatenate(negative_sample_list)[:self.negative_sample_size]
  
      # negative_sample = torch.from_numpy(negative_sample)
      # negative_sample = torch.from_numpy(np.random.randint(self.nentity, size=self.negative_sample_size))
      negative_sample = torch.randint(
          0, self.nentity, (self.negative_sample_size,)
      )
      positive_sample = torch.LongTensor(positive_sample)
  
      return (
          positive_sample,
          negative_sample,
          subsampling_weight,
          self.mode,
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import torch
  from torch.utils.data import Dataset
label_desc: Use image node_id 3 for calling the TrainDataset obj's underlying member method code with example usage: obj.__getitem__(idx) and returns: positive_sample,  negative_sample,  subsampling_weight,  self