Commit 76ca3352 by Tianqi Chen

fix tutorial build (#390)

parent 6a7d1c45
...@@ -41,9 +41,7 @@ import nnvm.testing ...@@ -41,9 +41,7 @@ import nnvm.testing
# This tutorial must be run with OpenGL backend enabled in TVM. # This tutorial must be run with OpenGL backend enabled in TVM.
# The NNVM CI does not enable OpenGL yet. But the user can run this script. # The NNVM CI does not enable OpenGL yet. But the user can run this script.
if not tvm.module.enabled("opengl"): opengl_enabled = tvm.module.enabled("opengl")
print("OpenGL backend not enabled. This tutorial cannot be run.")
exit(0)
# To run the local demo, set this flag to True. # To run the local demo, set this flag to True.
run_deploy_local = False run_deploy_local = False
...@@ -308,7 +306,7 @@ def deploy_local(): ...@@ -308,7 +306,7 @@ def deploy_local():
synset = download_synset() synset = download_synset()
print('TVM prediction top-1:', top1, synset[top1]) print('TVM prediction top-1:', top1, synset[top1])
if run_deploy_local: if run_deploy_local and opengl_enabled:
deploy_local() deploy_local()
###################################################################### ######################################################################
...@@ -412,7 +410,7 @@ def deploy_rpc(): ...@@ -412,7 +410,7 @@ def deploy_rpc():
# Print first 10 elements of output. # Print first 10 elements of output.
print(out.asnumpy()[0][0:10]) print(out.asnumpy()[0][0:10])
if run_deploy_rpc: if run_deploy_rpc and opengl_enabled:
deploy_rpc() deploy_rpc()
###################################################################### ######################################################################
...@@ -501,5 +499,5 @@ def deploy_web(): ...@@ -501,5 +499,5 @@ def deploy_web():
print("Please open http://localhost:" + str(port) + "/resnet.html") print("Please open http://localhost:" + str(port) + "/resnet.html")
httpd.serve_forever() httpd.serve_forever()
if run_deploy_web: if run_deploy_web and opengl_enabled:
deploy_web() deploy_web()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment