you can pass in the pointer of an existing pytorch torch.cuda.FloatTensor into C++ side and issue a cudaMemCpyAsync from OpenCV buffer to torch.cuda.FloatTensor buffer.
The pointer of the Tensor can be obtained with:
a = torch.cuda.FloatTensor(3, 640, 480) # new buffer of 3x640x480
pointer = a.data_ptr()
# pass this pointer into C/C++ side of your OpenCV pipeline
# copy the OpenCV buffer into CUDA

Lastly, when doing CUDA with datasets (i.e. multiprocessing with CUDA), you have to use python3 and spawn_server: http://pytorch.org/docs/notes/multiprocessing.html#sharing-cuda-tensors 103