libtorch加载模型出错:terminate called after throwing an instance of 'c10::Error'

libtorch加载模型出错:terminate called after throwing an instance of 'c10::Error'

    • 引言
    • solved

引言

报错:terminate called after throwing an instance of 'c10::Error'

solved

运行文件的路径有更改,将之前的参数传递路径直接改为绝对路径:

   // const char *net_fn = getenv("***_PATH");
   // net_fn = (net_fn == nullptr) ? "***.pt" : net_fn;
   // module = torch::jit::load(net_fn);

    module = torch::jit::load("/home/fb/XXX_SLAM2/xxx/***.pt");
    if (module == nullptr) {
        cout << "model load error !! " << endl;
    } else    cout << "Model load ok.\n";

你可能感兴趣的:(DeBug备忘)