Thank you for your answer!
The code comes from the official PyTorch training a classifier tutorial here
EDIT : Just found the mistake…
In the code below, I’ve not put “()” after the function ToTensor
transform = transforms.Compose([transforms.ToTensor, 
                               transforms.Normalize((0.5,0.5,0.5), (0.5,0.5,0.5))])

Which led to the TypeError. But I’ve got confused as the error pointed at the lines I’ve mentioned before on my first post.
Sorry for the inconvenience and thank you for your answer!