I have a small dataset with high-resolution images. I’m using the transform statement below before loading the data
transform = transforms.Compose([transforms.ToTensor(), 
                     transforms.Scale((256,256)), 
                     transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])

data_set = dset.ImageFolder(root="data",transform=transform)
dataloader = torch.utils.data.DataLoader(data, batch_size=4,shuffle=True,num_workers=2)

I’m getting memory error for the below code which I expect.
import matplotlib.pyplot as plt
%matplotlib inline
    
# obtain one batch of training images
dataiter = iter(train_loader)
images, labels = dataiter.next()
images = images.numpy()

Is there any other way to resize rescale and then load the data using pytorch?I. e., Not read the data directly from the folder and resize rescale by code then use  DataLoader ?