How to transfer an image to a Tensor in GPU with Libtorch

I want to implement a sliding window algorithm with CUDA and use a trained pytorch model to classify each cropped window.

I would like to transfer an image to GPU first, then do the further processing. How can I transfer an image data to Tensor when the data is already in GPU memory using cuda?