You should run the code without the question mark:
a = np.array([0, 1, np.nan])
x = torch.from_numpy(a)
print((x!=x).any())
> tensor(1, dtype=torch.uint8)

This can be used as a condition to check for NaNs in your input data.
Anyway, since the torchvision.transforms.Normalize module doesn’t create NaNs, your input data should be fine.
Could you post the code using the Normalize module so that I could debug both code snippets?