code: def __getitem__(self, idx):
      head, relation, tail = (
          self.triples["head"][idx],
          self.triples["relation"][idx],
          self.triples["tail"][idx],
      )
      positive_sample = torch.LongTensor((head, relation, tail))
  
      if self.mode == "head-batch":
          if not self.random_sampling:
              negative_sample = torch.cat(
                  [
                      torch.LongTensor([head]),
                      torch.from_numpy(self.triples["head_neg"][idx]),
                  ]
              )
          else:
              negative_sample = torch.cat(
                  [
                      torch.LongTensor([head]),
                      torch.randint(
                          0, self.nentity, size=(self.neg_size,)
                      ),
                  ]
              )
      elif self.mode == "tail-batch":
          if not self.random_sampling:
              negative_sample = torch.cat(
                  [
                      torch.LongTensor([tail]),
                      torch.from_numpy(self.triples["tail_neg"][idx]),
                  ]
              )
          else:
              negative_sample = torch.cat(
                  [
                      torch.LongTensor([tail]),
                      torch.randint(
                          0, self.nentity, size=(self.neg_size,)
                      ),
                  ]
              )
  
      return positive_sample, negative_sample, 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 TestDataset obj's underlying member method code with example usage: obj.__getitem__(idx) and returns: positive_sample,  negative_sample,  self