tensorflow: INTERNAL ERROR reported while trying to apply GpuDelegate to tflite

Please make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template

System information

  • Have I written custom code: Yes, I am using my own training model based on MobileNetV2.
  • OS Platform and Distribution: Ubuntu 18.04
  • Mobile device: XiaoMe 8, Android 9
  • tflite installed from (source or binary): nightly AAR (org.tensorflow:tensorflow-lite:0.0.0-nightly)
  • tflite-gpu installed from (source or binary): nightly AAR (org.tensorflow:tensorflow-lite-gpu:0.0.0-nightly)
  • GPU model and memory:

Describe the current behavior When I attempt to load my .tflite model on the Android (after applying the GpuDelegate), it fails saying “INTERNAL ERROR” (see traceback below). What does it mean for this error? And what shall I do? Thanks!

Describe the expected behavior The model should be loaded correctly and then run the Inference.

Code to reproduce the issue I just modify the downloaded TensorFlow Lite Android image classification example, and add one more class extended from class Classifier to load my own trained model which is based on MobileNetV2. The model loads and runs fine if with CPU, i.e. I do not attempt to apply the GPU delegate before the attempting to load it. The only difference in the code is the following lines:

tfliteOptions = new Interpreter.Options(); gpuDelegate = new GpuDelegate(); tfliteOptions.addDelegate(gpuDelegate);

Other info / logs

--------- beginning of crash

2019-05-21 08:27:02.183 13748-13769/org.tensorflow.lite.examples.classification E/AndroidRuntime: FATAL EXCEPTION: inference Process: org.tensorflow.lite.examples.classification, PID: 13748 java.lang.IllegalArgumentException: Internal error: Failed to apply delegate: TfLiteGpuDelegate Prepare: Shader compilation failed: ERROR: 0:6: ‘data’ : Syntax error: syntax error INTERNAL ERROR: no main() function! ERROR: 1 compilation errors. No code generated.

Node number 73 (TfLiteGpuDelegate) failed to prepare.

    at org.tensorflow.lite.NativeInterpreterWrapper.applyDelegate(Native Method)
    at org.tensorflow.lite.NativeInterpreterWrapper.init(NativeInterpreterWrapper.java:83)
    at org.tensorflow.lite.NativeInterpreterWrapper.<init>(NativeInterpreterWrapper.java:60)
    at org.tensorflow.lite.Interpreter.<init>(Interpreter.java:224)
    at org.tensorflow.lite.examples.classification.tflite.Classifier.<init>(Classifier.java:195)
    at org.tensorflow.lite.examples.classification.tflite.ClassifierNote.<init>(ClassifierNote.java:41)
    at org.tensorflow.lite.examples.classification.tflite.Classifier.create(Classifier.java:107)
    at org.tensorflow.lite.examples.classification.ClassifierActivity.recreateClassifier(ClassifierActivity.java:167)
    at org.tensorflow.lite.examples.classification.ClassifierActivity.lambda$onInferenceConfigurationChanged$0$ClassifierActivity(ClassifierActivity.java:146)
    at org.tensorflow.lite.examples.classification.-$$Lambda$ClassifierActivity$83lGy2TUjuj0M5n4BhMB9qlLgSY.run(Unknown Source:8)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:201)
    at android.os.HandlerThread.run(HandlerThread.java:65)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 17 (7 by maintainers)

Most upvoted comments

My device support OpenGL ES 3.2. I have run tensorflowlite image_classification demo with GPU correctly on my device. But when I changed to my own model, I got the errors.