pytorch version: 1.0.0.dev20181010
saving the model :
traced_script_module = torch.jit.trace(net, im_tensor)
traced_script_module.save('model.pt')
and then:
#include <torch/script.h>
#include <iostream>
#include <memory>
int main(int argc, const char* argv[]) {
if (argc != 2) {
std::cerr << "usage: example-app <path-to-exported-script-module>\n";
return -1;
}
// Deserialize the ScriptModule from a file using torch::jit::load().
std::shared_ptr<torch::jit::script::Module> module = torch::jit::load(argv[1]);
assert(module != nullptr);
std::cout << "ok\n";
}
and got an error in the terminate when loading the model:
terminate called after throwing an instance of 'std::runtime_error'
what(): unexpected string for type kind
Aborted (core dumped)
How to fix it?