Negative of MNIST Dataset

Viewed 187

I am trying to get the negative of the mnist dataset using pytorch. I download the datasets using pytorhc's dataloader, but am unsure of how to approach next. I'm not sure the datatype of the the set and am trying to subtract each pixel value from 255 to get the negative. Any help with how to adjust either the set or the loader would be greatly appreciated.

 train_set = tv.datasets.MNIST(root = "./data", train = True, download = True, transform = transforms.ToTensor())
test_set = tv.datasets.MNIST(root = "./data", train = False, download = True, transform = transforms.ToTensor())

train_dl = torch.utils.data.DataLoader(train_set, batch_size=64, shuffle=True)
val_dl = torch.utils.data.DataLoader(test_set, batch_size=1000, shuffle=False)
0 Answers
Related