Thanks for your elegant method，and I wonder whether the follow implementation is work：
first I just use

transform = transforms.ToTensor()

for ImageLoader to load the original dataset,
then use

scale_transform = transforms.Compose([
transforms.Scale(256),
transforms.RandomCrop(224),
])
data_fixed = scale_transform(data)
for scale the image of the dataset