简体   繁体   中英

TensorFlow Lite GPU delegate failure

I am trying to use TensorFlow Lite with GPU delegate on Android. I am using the lib version ( .so files) built from sources from the master branch of the repo. The problem is: the ModifyGraphWithDelegate function always returns error. And there is the following error message in logs:

2019-04-22 15:21:16.212 688-688/com.my.app E/tflite: TfLiteGpuDelegate Prepare: Shader compilation failed: ERROR: 0:6: 'unknown' : not a legal layout qualifier id 
    ERROR: 0:6: 'unknown' : Syntax error:  syntax error
    INTERNAL ERROR: no main() function!
    ERROR: 2 compilation errors.  No code generated.
2019-04-22 15:21:16.212 688-688/com.my.app E/tflite: Node number 54 (TfLiteGpuDelegate) failed to prepare.

If I use JAVA/JNI prebuilt lib version ('org.tensorflow:tensorflow-lite:0.0.0-gpu-experimental') like in official example project - there are no such errors. But I really need to use C++ interface for my cross-platform code.

Any thoughts / suggestions appreciated.

If you're building native shared library then you might need to manually load the .so library. See https://groups.google.com/a/tensorflow.org/forum/#!topic/tflite/5YhFsCFtKi4

I finally made it work. The internal reason of the error is still completely unknown for me but the point is:

  • The used (master branch) version of the TFLite GPU delegate for Android fails to properly prepare for running on GPU the standard (for regression task) output nodes combination = flatten + dense.
  • If replace it with reshape + convolution (pointwise) + squeeze, then it works fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM