i am stuck here.anyone help me how to get rid of this error.
here is my code:
criterion = nn.CrossEntropyLoss()
trainset = torchvision.datasets.ImageFolder(root='./train', transform=transform)
trainloader = torch.utils.data.DataLoader(trainset, batch_size=1,
                                          shuffle=True, num_workers=0)
singletestset = torchvision.datasets.ImageFolder(root='C:\\dataset\\FYP\\train1', transform=transform)
singletestloader = torch.utils.data.DataLoader(singletestset, batch_size=1,
                                        shuffle=False, num_workers=0)
classes = (' meningioma', 'glioma', 'pituitary tumor')

class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.conv1 = nn.Conv2d(3, 32, 3)
        self.pool = nn.MaxPool2d(2, 2)
        self.conv2 = nn.Conv2d(32, 64, 3)
        self.fc1 = nn.Linear(64*14*14, 30)
        self.fc2 = nn.Linear(30, 3)
        # self.softmax = nn.Softmax(dim=1)
    
    def forward(self, x):
        x = self.pool(F.relu(self.conv1(x))) # output size: [batch_size, 32, 255, 255]
        x = self.pool(F.relu(self.conv2(x))) # output size: [batch_size, 64, 126, 126]
        
        x = x.view(-1, 64*14*14) # output size: [batch_size, 64126126]
        print(x.shape)
        x = self.fc1(x)
        x = F.relu(x)
        x = self.fc2(x)
        # x=self.softmax(x)
        return x


model = Net()
state_dict = torch.load('last_brain1.pth')['state_dict']
model.load_state_dict(state_dict)


# =============================================================================
# img = Image.open('920.png')
# 
# transform = transforms.ToTensor()
# x = transform(img)
# x = x.unsqueeze(0)
# x = x.expand(-1, 3, -1, -1)
# 
# =============================================================================
#output = model(x)
 # Forward pass
#pred = torch.argmax(model, 1)  # Get predicted class if multi-class classification
#print('Image predicted as ', pred)
loss=0.0
correct=0
total=0.0
itr=0
model.eval()

for images,labels in singletestloader:
    images=Variable(images)
    labels=Variable(labels)
        #CUDA=torch.cuda.is_available()
        #if CUDA:
            #images=images.cuda()
            #labels=labels.cuda()
    outputs=model(images)
    loss=criterion(outputs,labels)
    loss+=loss.item()
    _,predicted=torch.max(outputs,1)
    total += labels.size(0)
    correct+=(predicted==labels).sum()
    itr+=1
    
    
    #testloss.append(loss/itr)
    #testaccuracy.append((100*correct/len(singletestset)))
    
    
    #print('training loss:%f %%' %(itrloss/itr))
   # print('training accuracy:%f %%'%(100*correct/len(trainset)))
    #print('test loss:%f %%'%(loss/itr))
    #print('test accuracy:%f %%'%((100*correct/len(singletestset))))
print('Accuracy of the network on the  test images: %d %%' % (
    100 * correct / total))
class_correct = list(0 for i in range(3))
class_total = list(0 for i in range(3))
with torch.no_grad():
    for data in singletestloader:
        images, labels = data
        images = Variable(images)
        labels = Variable(labels)
        outputs = model(images)
        _, predicted = torch.max(outputs, 1)
        c = (predicted == labels).squeeze()
        
        for i in range(labels.size(0)):
            label = labels[0]
            class_correct[label] += c[i].item()
            class_total[label] += 1
for i in range(3):
    print('Accuracy of %5s : %2f %%' % ( classes[i], 100 * class_correct[i] / class_total[i]))

and here is my error screenshot:

image.png1357×559 47 KB