class_docstr: Sampling inputs in the dataloader pairwise as mentioned in the paper "Regularizing Class-wise Predictions via Self-knowledge Distillation"
   https://arxiv.org/pdf/2003.13964.pdf
  
  :param dataset (torchvision.dataset): dataset
  :param batch_size (int): batch_size
  :param num_iterations (int): num_iterations
class_docstr_tok: ["Sampling","inputs","in","the","dataloader","pairwise","as","mentioned","in","the","paper","``","Regularizing","Class-wise","Predictions","via","Self-knowledge","Distillation","''","https",":","\/\/arxiv.org\/pdf\/2003.13964.pdf",":","param","dataset","(","torchvision.dataset",")",":","dataset",":","param","batch_size","(","int",")",":","batch_size",":","param","num_iterations","(","int",")",":","num_iterations"]
code: def __iter__(self):
      indices = list(range(len(self.dataset)))
      random.shuffle(indices)
      for k in range(len(self)):
          if self.num_iterations is None:
              offset = k * self.batch_size
              batch_indices = indices[offset : offset + self.batch_size]
          else:
              batch_indices = random.sample(
                  range(len(self.dataset)), self.batch_size
              )
  
          pair_indices = []
          for idx in batch_indices:
              y = self.dataset.get_class(idx)
              pair_indices.append(
                  random.choice(self.dataset.classwise_indices[y])
              )
  
          yield batch_indices + pair_indices
  
imports: import csv
  import os
  import random
  from collections import defaultdict
  import numpy
  import torchvision
  from PIL import Image
  from torch.utils.data import BatchSampler, DataLoader, Dataset, RandomSampler, Sampler, SequentialSampler, Subset
  from torchvision import datasets, transforms
label_desc: Use image node_id 2 for calling the PairBatchSampler obj's underlying member method code with example usage: obj.__iter__() without return types