I used this:
transform = transforms.Compose([transforms.ToTensor(),
                                        transforms.Normalize((0.5), (0.5))])
                               
                        
trainset = torchvision.datasets.MNIST(root='./data', train=True,
                                        download=True, transform=transform)
trainloader = torch.utils.data.DataLoader(trainset, batch_size=128,
                                          shuffle=True)

for i, data in enumerate (trainloader):

``