Ho sorry I were using python !
In cpp, I would just read the file directly into a cpu tensor instead of a vector.
Then send that Tensor on the GPU.
Note that you can always get the pointer to the gpu data from the pytorch cuda tensor to use in your own kernel.
Some example code for the cpp extensions include working with cuda Tensors here 37. You can ignore the part that exports it to python.