transforms.Grayscale works on PIL.Images so you should put it before transforms.ToTensor.
Also, transforms.Normalize would then only take a single value for the mean and standard deviation.
transform = transforms.Compose([
    transforms.Grayscale(1),
    transforms.ToTensor(),
    transforms.Normalize((0.5,), (0.5,))
])