You are trying to use the functional API operation in a transformation, which won’t work directly, so wrap it in e.g. transforms.Lambda or write a custom transformation class.
This should work:
data = torch.randn(100, 3, 224, 224)
out = torchvision.transforms.functional.invert(data)

transform = torchvision.transforms.Compose([
    torchvision.transforms.Lambda(lambda x: torchvision.transforms.functional.invert(x))
])
out = transform(data)

Also, since you are passing the current transform to the MNIST dataset, it will be applied on each sample, not the entire dataset.