This warning also occurs when processing the raw dataset downloaded using MNIST class in torchvision.datasets
The processing function is  read_sn3_pascalvincent_tensor() and it is defined inside mnist.py file in the API itself. One of the solutions presented here can be implemented inside this function.