I have the below code but i don’t know where is wrong that i get error
trainset = torchvision.datasets.MNIST(root ='./data',
[transforms.ToTensor(), transforms.Lambda(lambda x: x * 64)]
here is the error:
ValueError: only one element tensors can be converted to Python scalars
What you are loading is the train_loader. You can get a batch of images from it using
images, labels = next(iter(train_loader))
The shapes of these are as follows
> (torch.Size([128, 1, 28, 28]))
For plotting you need to use the last 2 dimensions (width and height)
thank you …it worked for me
just one question:
(torch.Size([128, 1, 28, 28]))
what is 128 …is that batch_size?
Yes, it is the batch size.