I want build some preprocess tensor in my c++ code, example as
# include "common/libtorch/include/torch/script.h"
# include "common/libtorch/include/torch/csrc/api/include/torch/torch.h"
# include <iostream>
# include <vector>
using namespace std;
int main(int argc, char *argv[]) {
// 构建示例输入
// std::vector<torch::jit::IValue> inputs;
std::vector<int64_t> res_data;
res_data.resize(1 * 3* 16 * 16);
cout << res_data.size() << endl;
torch::Tensor res_tensor = torch::from_blob(res_data.data(),{1, 3, 16, 16}, torch::kInt64);
cout << "OK" << endl;
}
but i got the error:
terminate called after throwing an instance of 'std::system_error'
what(): Unknown error -1
Aborted (core dumped)
my g++ version=5.5,using std=c++14 option,my libtorch version=1.5. Is someone know about this error ? thank you very much !!