docstr: For every sample in the batch we select 3 images. First one is the anchor image
  which is the image obtained from the current index. We also obtain the label of
  anchor image.
  
  Now we select two random images, one belonging to the same class as that of the
  anchor image (named as positive_image) and the other belonging to a different class
  than that of the anchor image (named as negative_image). We return the anchor image,
  positive image, negative image and anchor label.
docstr_tok: ["For","every","sample","in","the","batch","we","select","3","images",".","First","one","is","the","anchor","image","which","is","the","image","obtained","from","the","current","index",".","We","also","obtain","the","label","of","anchor","image",".","Now","we","select","two","random","images",",","one","belonging","to","the","same","class","as","that","of","the","anchor","image","(","named","as","positive_image",")","and","the","other","belonging","to","a","different","class","than","that","of","the","anchor","image","(","named","as","negative_image",")",".","We","return","the","anchor","image",",","positive","image",",","negative","image","and","anchor","label","."]
code: def __getitem__(self, index):
      """
      For every sample in the batch we select 3 images. First one is the anchor image
      which is the image obtained from the current index. We also obtain the label of
      anchor image.
  
      Now we select two random images, one belonging to the same class as that of the
      anchor image (named as positive_image) and the other belonging to a different class
      than that of the anchor image (named as negative_image). We return the anchor image,
      positive image, negative image and anchor label.
      """
  
      # obtain the anchor image
      anchor_image = self.data[index].float()
  
      # obtain the class label of the anchor image
      anchor_label = self.dataset.targets[index]
      anchor_label = int(anchor_label.item())
  
      # find a label which is different from anchor_label
      labels = list(range(0, 10))
      labels.remove(anchor_label)
      neg_index = torch.randint(0, 9, (1,)).item()
      neg_label = labels[neg_index]
  
      # get a random index from the range range of indices
      random_index = torch.randint(
          0, len(self.grouped_examples[anchor_label]), (1,)
      ).item()
  
      # get the index of image in actual data using the anchor label and random index
      positive_index = self.grouped_examples[anchor_label][random_index]
  
      # choosing a random image using positive_index
      positive_image = self.data[positive_index].float()
  
      # get a random index from the range range of indices
      random_index = torch.randint(
          0, len(self.grouped_examples[neg_label]), (1,)
      ).item()
  
      # get the index of image in actual data using the negative label and random index
      negative_index = self.grouped_examples[neg_label][random_index]
  
      # choosing a random image using negative_index
      negative_image = self.data[negative_index].float()
  
      return anchor_image, positive_image, negative_image, anchor_label
  
imports: import argparse
  import numpy
  import torch
  import torch.nn
  import torch.optim
  import torchvision
  from torch.optim.lr_scheduler import StepLR
  from torch.utils.data import DataLoader, Dataset
  from torchvision import datasets
  from ignite.contrib.handlers import ProgressBar
  from ignite.engine import Engine, Events
  from ignite.handlers.param_scheduler import LRScheduler
  from ignite.metrics import Accuracy, RunningAverage
  from ignite.utils import manual_seed
label_desc: Use image node_id 4 for calling the MatcherDataset obj's underlying member method code with example usage: obj.__getitem__(index) and returns: anchor_image,  positive_image,  negative_image,  anchor_label