Solved by ptrblck in post #2 
              
              
                How did you define path_digit? 
The torchvision.datasets.MNIST dataset uses the internal data attribute to load all images from the downloaded binary files, so I’m not sure how you extracted the paths. 
EDIT: Seems to be solved in this topic.