Deploy to Android#

Build model for Android Target#

Relay compilation of model for android target could follow same approach like android_rpc. The code below will save the compilation output which is required on android target.

lib.export_library("deploy_lib.so", fcompile=ndk.create_shared)
with open("deploy_graph.json", "w") as fo:
    fo.write(graph.json())
with open("deploy_param.params", "wb") as fo:
    fo.write(runtime.save_param_dict(params))

deploy_lib.so, deploy_graph.json, deploy_param.params will go to android target.

TVM Runtime for Android Target#

Refer here to build CPU/OpenCL version flavor TVM runtime for android target. From android java TVM API to load model & execute can be referred at this java sample source.