Obtaining the Dataset
MNIST handwritten digits dataset contains images of handwritten digits at a grey scale. Grey Scale images are ones that can be understood as black and white images. So while loading the dataset we need to convert these images to some datatype that PyTorch can understand. PyTorch uses data as a Tensor type. A Tensor can be understood as a container that stores data in some n dimensions. It also stores some useful data, such as the relationship between its elements and the relationship with other elements. But we can ignore these for now. We also normalize each image with a mean and standard deviation of 0.5.
transform = transforms.Compose([transforms.ToTensor(),
transforms.Normalize((0.5,), (0.5,)),
])
train_data = datasets.MNIST('PATH_TO_STORE_TRAINSET', download=True, train=True, transform=transform)
test_data = datasets.MNIST('PATH_TO_STORE_TRAINSET', download=True, train=False, transform=transform)1
