In general, I wouldn’t recommend doing this. But I see no reason why you couldn’t if you defined your own transforms that only used tensor ops (so ToTensor would be first). The default ones use PIL. I’m not sure if this will cause any issues with the default batch collate though, it may expect data to be on the CPU. I haven’t looked closely
Either way, I would say don’t bother for this reason, GPU memory is a much more limited resource and CPU to GPU copy isn’t free. Better to use the default data pipeline and load, process, collate on the CPU and then copy to GPU. Especially if your input images are larger than your network input which is often the case. You don’t want 640x480 images being loaded on the the GPU if you’re cropping to 224x224 anyways.
The only ‘preprocessing’ type op I sometimes put on the GPU (as pseudo model layer) is per-image normalization (x - mean(x))/std(x) that operates on batches of images.