#include <opencv2/opencv.hpp>
#include <torch/script.h>
#include <torch/torch.h>
#include 
#include
//测试环境是否有问题
int main()
{
std::cout << “cuda::is_available():” << torch::cuda::is_available() << std::endl;// CUDA是否可用
std::cout << “cudnn_is_available():” << torch::cuda::cudnn_is_available() << std::endl;// cuDNN 是否可用
std::cout << “cuda::device_count():” << torch::cuda::device_count() << std::endl;// 可使用的GPU个数
torch::DeviceType device_type = at::kCPU; // 定义设备类型
if (torch::cuda::is_available())
    device_type = at::kCUDA;
std::cout << device_type << std::endl;

//torch::Tensor tensor = torch::rand({ 5,3 });
torch::Tensor tensor = torch::rand({ 5,3 }).to(device_type);
std::cout << tensor << std::endl;

return 0;

}