text: import torchvision.transforms.functional as F
  import torchvision.transforms.transforms as Transforms
  from torchvision.utils import make_grid
  import matplotlib.pyplot as plt
  import numpy as np
  from opendc.feature_extract.memory import MemoryBank, fill_memory_bank
  
  
  def show(imgs):
      if not isinstance(imgs, list):
          imgs = [imgs]
      fix, axs = plt.subplots(ncols=len(imgs), figsize=(12, 12), squeeze=False)
      for i, img in enumerate(imgs):
          img = img.detach()
          img = F.to_pil_image(img)
          axs[0, i].imshow(np.asarray(img))
          axs[0, i].set(xticklabels=[], yticklabels=[], xticks=[], yticks=[])
  
  
  def getImg(trainset, index):
      img = trainset.__getitem__(index)['image']
      return img
  
  def plot_nearest_neighbors(loader,
                             model,
                             dataset,
                             anchor_list = [1, 17, 800, 975, 702],
                             save_path='./nearest_neighbors.jpg'):
      '''
      :param loader:
      :param model:
      :param dataset: transform function is ToTensor() only
      :return:
      '''
      memory_bank = MemoryBank()
      fill_memory_bank(loader, model, memory_bank)
  
      indices, acc = memory_bank.mine_nearest_neighbors(5)  # TO change
      img_list = []
  
      for i in anchor_list:
          img_list.extend(indices[i])
  
      plt.rcParams["savefig.bbox"] = 'tight'
  
      image_list = [getImg(dataset, img_list[i]) for i in range(len(img_list))]
      img = make_grid(image_list, nrow=len(anchor_list), padding=5, pad_value=1)
      show(img)
      plt.savefig(save_path)