I found if use cv::cuda::GpuMat to create tensor, it will cause a segmentfault.
my code:
cv::Mat image = cv::imread(argv[1], cv::IMREAD_COLOR);
cv::cuda::GpuMat image_device;
cv::cuda::GpuMat image_float_device;
image_device.upload(image);
image_device.convertTo(image_float_device, CV_32FC3);
at::Tensor input_tensor = torch::CUDA(torch::kFloat32).tensorFromBlob(img_float_device.data, {img_float_device.rows, img_float_device.cols, 3});
std::cout << "all finished!" << std::endl;
return 0;

The sentence “all finished!” could be print.
But it will cause a segment fault, I guess maybe due to the tensor destructor ?
How could I fix the problem?
Appreciate for any help~