[DOCS] Fix the QNN TFLite tutorial build (#5641)
authorTianqi Chen <tqchen@users.noreply.github.com>
Thu, 21 May 2020 17:22:31 +0000 (10:22 -0700)
committerGitHub <noreply@github.com>
Thu, 21 May 2020 17:22:31 +0000 (10:22 -0700)
* [TUTORIAL] Fix execution error of TFLite quantized tutorial

* Assign TensorCore to docs build

Jenkinsfile
tutorials/frontend/deploy_prequantized_tflite.py

index 60ee142..1d711dd 100644 (file)
@@ -259,7 +259,7 @@ stage('Integration Test') {
     }
   },
   'docs: GPU': {
-    node('GPU') {
+    node('TensorCore') {
       ws(per_exec_ws("tvm/docs-python-gpu")) {
         init_git()
         unpack_lib('gpu', tvm_multilib)
index f6c4544..3cdd423 100644 (file)
@@ -114,8 +114,13 @@ data = get_real_image(224, 224)
 tflite_model_file = os.path.join(model_dir, "mobilenet_v2_1.0_224_quant.tflite")
 tflite_model_buf = open(tflite_model_file, "rb").read()
 
-tflite_model = tflite.Model.GetRootAsModel(tflite_model_buf, 0)
-
+# Get TFLite model from buffer
+try:
+    import tflite
+    tflite_model = tflite.Model.GetRootAsModel(tflite_model_buf, 0)
+except AttributeError:
+    import tflite.Model
+    tflite_model = tflite.Model.Model.GetRootAsModel(tflite_model_buf, 0)
 
 ###############################################################################
 # Lets run TFLite pre-quantized model inference and get the TFLite prediction.