flutter-tflite icon indicating copy to clipboard operation
flutter-tflite copied to clipboard

Select TensorFlow op(s), included in the given model, is(are) not supported by this interpreter

Open utkukozan opened this issue 1 year ago • 9 comments

I am getting this error when i am using my custom tflite model which detects pose and running in python successfully. My app level build.gradle file contains:

dependencies {
    implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly-SNAPSHOT'
    implementation 'org.tensorflow:tensorflow-lite-select-tf-ops:0.0.0-nightly-SNAPSHOT'
}
  defaultConfig {
          ndk {
              abiFilters 'armeabi-v7a', 'arm64-v8a'
          }
      }

    aaptOptions {
        noCompress 'tflite'
        noCompress 'lite'
    }

And when i tried to initialize this model with this code :

tfl.Interpreter? interpreter = await tfl.Interpreter.fromAsset('assets/ml/model.tflite');

I am getting this error :

Select TensorFlow op(s), included in the given model, is(are) not supported by this interpreter.
Make sure you apply/link the Flex delegate before inference.
For the Android, it can be resolved by adding "org.tensorflow:tensorflow-lite-select-tf-ops" dependency.
See instructions: https://www.tensorflow.org/lite/guide/ops_select
Node number 3 (FlexTensorListReserve) failed to prepare.
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Bad state: failed precondition

Also my python TFLite convert method includes supported ops that see in tensorflow documents

converter.target_spec.supported_ops = [
  tf.lite.OpsSet.TFLITE_BUILTINS, # enable TensorFlow Lite ops.
  tf.lite.OpsSet.SELECT_TF_OPS # enable TensorFlow ops.
]

Could you please help me for solve this problem ?

utkukozan avatar Dec 20 '23 13:12 utkukozan

Hey, I have the same issue, have you already resolved it?

jonasscheffner avatar Jan 02 '24 11:01 jonasscheffner

Hey, I have the same issue, have you already resolved it?

No unfortunately I couldn't solve it

utkukozan avatar Jan 02 '24 17:01 utkukozan

This is because this library does not currently support Flex delegate.

ghost avatar Jan 03 '24 07:01 ghost

same problem

OysterQAQ avatar Jan 04 '24 12:01 OysterQAQ

Can we add support for the flex delegate? How would we go about doing it?

gianlucasama avatar Feb 01 '24 15:02 gianlucasama

same problem +1 who can share the answer, thanks

aidemHJC avatar May 07 '24 07:05 aidemHJC

Can we add support for the flex delegate? How would we go about doing it?

So this is a 'new feature' or 'enhancement' or 'wish list' type issue rather than a bug-issue? If you think this is a bug, a failing test case (aligned with the existing tests) would be useful to demonstrate the bug. Does the documentation clearly state this unsupportiveness? The contributions to the documentation are invaluable. Can someone with the permissions add appropriate label(s) to this issue?

iorixxx avatar May 31 '24 08:05 iorixxx

Ilooked it up, but I still can't find the answer. Has anyone solved it?

shuizhuyu1015 avatar Jul 11 '24 09:07 shuizhuyu1015

+1 Same problem with me Node number 47 (FlexMatMul) failed to prepare.

lukaskris avatar Aug 12 '24 00:08 lukaskris