onnxruntime-tvm/nnvm
Alexander Pivovarov f33b9eae4b Fix some typos in api docs (#3309) 2019-06-07 00:01:01 -07:00
..
amalgamation [HEADER] Add Header to Comply with ASF Release Policy (#2982) 2019-04-07 21:14:02 -07:00
include/nnvm Fix some typos in api docs (#3309) 2019-06-07 00:01:01 -07:00
make Make choice of archiver configurable (#288) 2018-05-29 08:47:00 -07:00
python Fix some typos in api docs (#3309) 2019-06-07 00:01:01 -07:00
src Minor improve to assertion (#3295) 2019-06-06 15:14:11 -07:00
tests [TOPI] Fix resize nearest with fractional scaling (#3244) 2019-05-28 15:20:58 -07:00
tutorials [RELAY]Frontend darknet (#2773) 2019-05-25 06:38:08 +09:00
Makefile [HEADER] Add Header to Comply with ASF Release Policy (#2982) 2019-04-07 21:14:02 -07:00
README.md [HEADER] Add Header to Comply with ASF Release Policy (#2982) 2019-04-07 21:14:02 -07:00

README.md

NNVM Compiler Module of TVM Stack

import tvm
from tvm.contrib import graph_runtime, rpc
import nnvm.frontend
import nnvm.compiler

# GET model from frameworks
# change xyz to supported framework name.
graph, params = nnvm.frontend.from_xyz(...)

# OPTIMIZE and COMPILE the graph to get a deployable module
# target can be "opencl", "llvm", "metal" or any target supported by tvm
target = "cuda"
graph, lib, params = nnvm.compiler.build(graph, target, {"data", data_shape}, params=params)

# DEPLOY and run on gpu(0)
module = graph_runtime.create(graph, lib, tvm.gpu(0))
module.set_input(**params)
module.run(data=data_array)
output = tvm.nd.empty(out_shape, ctx=tvm.gpu(0))
module.get_output(0, output)

# DEPLOY to REMOTE mobile/rasp/browser with minimum tvm rpc runtime
# useful for quick experiments on mobile devices
remote = rpc.connect(remote_host, remote_port)
lib.export_library("mylib.so")
remote.upload("mylib.so")
rlib = rpc.load_module("mylib.so")
# run on remote device
rmodule = graph_runtime.create(graph, rlib, remote.gpu(0))
rmodule.set_input(**params)
rmodule.run()