-
Notifications
You must be signed in to change notification settings - Fork 203
Closed
Labels
Description
I am trying to load a Pytorch model in C++ with pytorch_scatter operation --> A.pt
I first build C++ API of pytorch_scatter.
And, then in vs 2017, I include in additional include directores;
pytorch_scatter-2.0.5\csrc
pytorch_scatter-2.0.5\csrc\cpu
also, in linker --> additional Library dictories:
\pytorch_scatter-2.0.5\build3\Release
The project build with no errors.
But, the executable still can not load the model A.pt.
However, if I modify and save the model without using scatter operation --> A_no_Scatter.pt
The executable can load the model.
Here is my C++ file:
#include <torch/script.h> // One-stop header.
#include <iostream>
#include <memory>
#include <torch/torch.h>
#include <scatter.h>
int main(int argc, const char* argv[]) {
if (argc != 2) {
std::cerr << "usage: example-app <path-to-exported-script-module>\n";
return -1;
}
std::cout << argv[1] << "\n";
torch::jit::script::Module module;
try {
// Deserialize the ScriptModule from a file using torch::jit::load().
module = torch::jit::load(argv[1]);
}
catch (const c10::Error& e) {
std::cerr << "error loading the model\n";
std::cout << e.what() << std::endl;
return -1;
}
std::cout << "ok\n";
}
Can anyone tell me what else I need to do?
Thanks.