@masahi,
In this question, I am not extracting shared library .so file, I build with extracted .o file, I do this in python with this line
lib_path = os.path.join(project_root, 'unet_deploy_arm.tar')
lib.export_library(lib_path,fcompile=False)
graph_json_path = os.path.join(project_root, 'unet.json')
with open(graph_json_path, 'w') as fo:
fo.write(graph.json())
param_path = os.path.join(project_root, 'unet.params')
with open(param_path, 'wb') as fo:
fo.write(nnvm.compiler.save_param_dict(params))
Then in a C++ application I do this:
tvm::runtime::Module mod_syslib = (*tvm::runtime::Registry::Get("module._GetSystemLib"))();
// json graph
std::ifstream json_in("unet.json", std::ios::in);
std::string json_data((std::istreambuf_iterator<char>(json_in)), std::istreambuf_iterator<char>());
json_in.close();
// parameters in binary
std::ifstream params_in("unet.params", std::ios::binary);
std::string params_data((std::istreambuf_iterator<char>(params_in)), std::istreambuf_iterator<char>());
params_in.close();
// parameters need to be TVMByteArray type to indicate the binary data
TVMByteArray params_arr;
params_arr.data = params_data.c_str();
params_arr.size = params_data.length();
int dtype_code = kDLFloat;
int dtype_bits = 32;
int dtype_lanes = 1;
int device_type = kDLCPU;
int device_id = 0;
// get global function module for graph runtime
tvm::runtime::Module mod = (*tvm::runtime::Registry::Get("tvm.graph_runtime.create"))(json_data, mod_syslib, device_type, device_id);
std::cout << "Graph created"<<std::endl;
I cross-compile the source code above, and link it with the lib.o in the .tar file.
I get the error by calling tvm.graph_runtime.create, I suppose, loading the module was not done correctly, any idea how to debug this?