Reputation: 41
Cmake3.17 libtorch 1.2 pytorch1.2 VS2015
#include <torch/script.h> // One-stop header.
#include <iostream>
#include<stdlib.h>
#include <memory>
int main() {
torch::jit::script::Module module = torch::jit::load("F:\\test.pt");
std::vector<torch::jit::IValue> inputs;
inputs.push_back(torch::ones({ 36, 9, 64, 64 }));
auto outputs = module.forward(inputs).toTuple();
std::cout << "ok\n";
system("pause");
}
when i load .pt is correct,but c10::Error in module.forward(inputs).toTuple();
Upvotes: 3
Views: 5507
Reputation: 1952
You can try to add "-D_GLIBCXX_USE_CXX11_ABI=0"
to your build command. This issue is described in full detail at https://github.com/pytorch/pytorch/issues/13541 which fundamentally indicates that you have an ABI issue.
Upvotes: 2