How to generate a Tensor from a cv::cuda::GpuMat directly?

Normally we could generate a Tensor from cv::Mat by:

cv::Mat img = ....
img.convertTo(img, CV_32FC3, 1.0f / 255.0f);
at::Tensor tensor = torch::from_blob(img.data, {img.rows, img.cols, 3});

But when this img is a cv::cuda::GpuMat the torch::from_blob can’t work.

Signal: SIGSEGV (Segmentation fault)

I hope the tensor is same device with this cv::cuda::GpuMat,Does libtorch support this?