To me, the code works with MNIST dataset.

  
      gist.github.com
  
  
    https://gist.github.com/InnovArul/53ea0f93462bf1d8f77c9bb0e6e54125 87
inception-v3-query.py
from __future__ import print_function
from __future__ import division
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import torchvision
from torchvision import datasets, models, transforms
from torch.autograd import Variable
import matplotlib.pyplot as plt
This file has been truncated. show original




  
  
    
    
  
  


One caveat I found with your code is that you are using both ‘validation’, ‘val’ for denoting validation phase. I do not think dataloaders[phase] exists when phase=val.