Solved by Nikronic in post #2 
              
              
                Hi, 
You are setting transforms into batch_size. DataLoader does not accept transforms, you need to apply it on Dataset. 

dataset = ImageFolderWithPaths(data_dir, transform=transforms.Compose([transforms.ToTensor()]))
dataloader = DataLoader(dataset, batch_size=16)

Or I think you mistyped Dataload…