In my preprocessing pipeline I am doing something like this:
preprocess = transforms.Compose([
            transforms.Scale(100),
            transforms.CenterCrop(100),
            transforms.ToTensor()
        ])

img = Image.open('image_path')
img_t = preprocess(img).cuda()

As far as I understand, the complete preprocessing would be performed by the CPU, as img is not a cuda Tensor. It will be moved to the GPU only after preprocessing. Is there any possibility to do this on GPU and only have the CPU do the read from disk?