Hi Guys, I try to extend the Module Export Example
from tvm import relay
from tvm.relay import testing
from tvm.contrib import util
import tvm
# Resnet18 workload
resnet18_mod, resnet18_params = relay.testing.resnet.get_workload(num_layers=18)
# build
with relay.build_config(opt_level=3):
_, resnet18_lib, _ = relay.build_module.build(resnet18_mod, "cuda", params=resnet18_params)
# create one tempory directory
temp = util.tempdir()
# path lib
file_name = "deploy.so"
path_lib = temp.relpath(file_name)
# export library
resnet18_lib.export_library(path_lib)
# load it back
loaded_lib = tvm.runtime.load_module(path_lib)
assert loaded_lib.type_key == "library"
assert loaded_lib.imported_modules[0].type_key == "cuda"
func = loaded_lib.entry_func
However, when I tried to get the entry_func
of loaded_lib
, I got the error below:
File "../src/runtime/library_module.cc", line 49
TVMError: Check failed: entry_name != nullptr: Symbol __tvm_main__ is not presented
My question is that is it an expected result? If not, what is the right way to use the lib exported by Relay?