transforms.Normalize __init__() takes exactly 2 arguments (3 given)

Well, my code is like above, when I run, there is an error:

transform = transforms.Compose(transforms.ToTensor(),transforms.Normalize(mean=[0.5], std=[0.5]))

TypeError: init() takes exactly 2 arguments (3 given)

However, I found the init function of class Normalize(object) have 2 inputs indeed, and they are std and mean. So could anyone can help to find what’s wrong with the codes?

The error seems to be thrown by transforms.Compose rather than Normalize. You have to wrap your transformations in []. The docs have an example.

Thank you very much~~~