This code provides a helper for retrieving standard datasets from Torchvision, such as MNIST, CIFAR10, etc. It moreover provides the denormalization step, which is required before graphical representations of the image tensors.
from torch.utils.data import Dataset, DataLoader
from torchvision.transforms import Compose, ToTensor, Grayscale, Normalize, RandomResizedCrop
from torchvision.datasets import MNIST, CIFAR10, CIFAR100
import torch
from typing import Tuple
import os