I want to use my own image database in nn and don't know how to transform the images

my code is like this:
transform = transforms.Compose([transforms.Scale(32, 32),
transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)),
transforms.ToPILImage()])

trainset = dset.ImageFolder(root = ‘./imgs’, transform = transform)
trainloader = torch.utils.data.DataLoader(trainset, batch_size = 4,
shuffle=True, num_workers=2)

and when I iterate through the trainset I got the error:
ValueError: unknown resampling filter
I got no idea on how to wrap the transform functions, and I found no tutorial or documents explain this in detail.

you dont need the last transforms.ToPILImage(). See https://github.com/pytorch/examples for a few examples to help you.