Hello! I was loading a nn.model generated by Gpytorch.
I am using the example here https://github.com/cornellius-gp/gpytorch/blob/master/examples/04_Variational_and_Approximate_GPs/Modifying_the_variational_strategy_and_distribution.ipynb 1 with CPU for training device.
I traced the model with the same code here https://github.com/cornellius-gp/gpytorch/blob/master/examples/08_Advanced_Usage/TorchScript_Variational_Models.ipynb 1. (CPU only)
The traced model works fine in python.
My c++ front-end implementation is
torch::Device device_ = torch::kCPU
try {
torch_model_ = torch::jit::load(torch_model_file, torch::device_);
} catch (const c10::Error& e) {
return;
}
std::vectortorch::jit::IValue torch_inputs;
torch_inputs.push_back(torch::ones({1024, 18}));
auto torch_output = torch_model_.forward(torch_inputs);
I got a segment fault in the forward func.
Any suggestions? Thanks!