From 5e993a8595378c944ee12be633ca7794a8982b56 Mon Sep 17 00:00:00 2001 From: tqchen Date: Tue, 28 Jul 2020 08:48:14 -0700 Subject: [PATCH] Correct runtime.load_module --- docs/deploy/hls.rst | 6 +++--- docs/dev/introduction_to_module_serialization.rst | 2 +- docs/dev/relay_bring_your_own_codegen.rst | 6 +++--- rust/tvm/examples/resnet/src/build_resnet.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/deploy/hls.rst b/docs/deploy/hls.rst index 64717ed1e678..da1721dc23f3 100644 --- a/docs/deploy/hls.rst +++ b/docs/deploy/hls.rst @@ -64,11 +64,11 @@ We use two python scripts for this tutorial. tgt="sdaccel" - fadd = tvm.runtime.load("myadd.so") + fadd = tvm.runtime.load_module("myadd.so") if os.environ.get("XCL_EMULATION_MODE"): - fadd_dev = tvm.runtime.load("myadd.xclbin") + fadd_dev = tvm.runtime.load_module("myadd.xclbin") else: - fadd_dev = tvm.runtime.load("myadd.awsxclbin") + fadd_dev = tvm.runtime.load_module("myadd.awsxclbin") fadd.import_module(fadd_dev) ctx = tvm.context(tgt, 0) diff --git a/docs/dev/introduction_to_module_serialization.rst b/docs/dev/introduction_to_module_serialization.rst index 78f6d7117dd8..5451b84c9b8c 100644 --- a/docs/dev/introduction_to_module_serialization.rst +++ b/docs/dev/introduction_to_module_serialization.rst @@ -53,7 +53,7 @@ Let us build one ResNet-18 workload for GPU as an example first. resnet18_lib.export_library(path_lib) # load it back - loaded_lib = tvm.runtime.load(path_lib) + loaded_lib = tvm.runtime.load_module(path_lib) assert loaded_lib.type_key == "library" assert loaded_lib.imported_modules[0].type_key == "cuda" diff --git a/docs/dev/relay_bring_your_own_codegen.rst b/docs/dev/relay_bring_your_own_codegen.rst index 0cced36c95c1..4d761bf8129b 100644 --- a/docs/dev/relay_bring_your_own_codegen.rst +++ b/docs/dev/relay_bring_your_own_codegen.rst @@ -905,7 +905,7 @@ We also need to register this function to enable the corresponding Python API: TVM_REGISTER_GLOBAL("module.loadbinary_examplejson") .set_body_typed(ExampleJsonModule::LoadFromBinary); -The above registration means when users call ``tvm.runtime.load(lib_path)`` API and the exported library has an ExampleJSON stream, our ``LoadFromBinary`` will be invoked to create the same customized runtime module. +The above registration means when users call ``tvm.runtime.load_module(lib_path)`` API and the exported library has an ExampleJSON stream, our ``LoadFromBinary`` will be invoked to create the same customized runtime module. In addition, if you want to support module creation directly from an ExampleJSON file, you can also implement a simple function and register a Python API as follows: @@ -930,7 +930,7 @@ In addition, if you want to support module creation directly from an ExampleJSON *rv = ExampleJsonModule::Create(args[0]); }); -It means users can manually write/modify an ExampleJSON file, and use Python API ``tvm.runtime.load("mysubgraph.examplejson", "examplejson")`` to construct a customized module. +It means users can manually write/modify an ExampleJSON file, and use Python API ``tvm.runtime.load_module("mysubgraph.examplejson", "examplejson")`` to construct a customized module. ******* Summary @@ -954,7 +954,7 @@ In summary, here is a checklist for you to refer: * ``Run`` to execute a subgraph. * Register a runtime creation API. * ``SaveToBinary`` and ``LoadFromBinary`` to serialize/deserialize customized runtime module. - * Register ``LoadFromBinary`` API to support ``tvm.runtime.load(your_module_lib_path)``. + * Register ``LoadFromBinary`` API to support ``tvm.runtime.load_module(your_module_lib_path)``. * (optional) ``Create`` to support customized runtime module construction from subgraph file in your representation. * An annotator to annotate a user Relay program to make use of your compiler and runtime (TBA). diff --git a/rust/tvm/examples/resnet/src/build_resnet.py b/rust/tvm/examples/resnet/src/build_resnet.py index a09a0c3a56eb..1142f9970385 100644 --- a/rust/tvm/examples/resnet/src/build_resnet.py +++ b/rust/tvm/examples/resnet/src/build_resnet.py @@ -112,7 +112,7 @@ def download_img_labels(): def test_build(build_dir): """ Sanity check with random input""" graph = open(osp.join(build_dir, "deploy_graph.json")).read() - lib = tvm.runtime.load(osp.join(build_dir, "deploy_lib.so")) + lib = tvm.runtime.load_module(osp.join(build_dir, "deploy_lib.so")) params = bytearray(open(osp.join(build_dir,"deploy_param.params"), "rb").read()) input_data = tvm.nd.array(np.random.uniform(size=data_shape).astype("float32")) ctx = tvm.cpu()