Error iterating DataLoader

I am having trouble with the dataloader.

normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])

dataset = datasets.ImageFolder(root='images', transform=transforms.Compose([normalize]))
test_loader = torch.utils.data.DataLoader(dataset, batch_size=4, shuffle=True)
for i, (input, target) in enumerate(test_loader):
    pass

Error:
TypeError: zip argument #1 must support iteration

The “images” directory has single subdirectory with single image.

Maybe you could do something like this:

for i, itr in enumerate(test_loader):
     input, target = itr[0], itr[1]
     pass

It gives the same error. I think the problem is with test_loader not being iterable!

Oh silly mistake. I forgot to inclue ToTensor() transform.

This works;
dataset = datasets.ImageFolder(root='images', transform=transforms.Compose([transforms.ToTensor(), normalize]))