Solved by MariosOreo in post #2 
              
              
                The MNIST dataset from torchvision is in PIL image. So if you want to flatten MNIST images, you should transform the images into tensor format by transforms.ToTensor() in transforms.Compose([]). And then you could use DataLoader to load the images, read and flatten batches of them. 
In my shallow vi…