Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using GPU for tflite #205

Open
NQHuy1905 opened this issue Mar 27, 2024 · 3 comments
Open

Using GPU for tflite #205

NQHuy1905 opened this issue Mar 27, 2024 · 3 comments

Comments

@NQHuy1905
Copy link

NQHuy1905 commented Mar 27, 2024

Hi, i want to use mobile GPU to infer my model

I see document and use this code to load model

final options = InterpreterOptions();
      if (Platform.isAndroid) {
        options.addDelegate(GpuDelegateV2());
      }
final interpreter =
          await tfl.Interpreter.fromAsset('assets/MaskPose.tflite', options: options);

but it logout error like this

E/tflite (27005): PADV2: Operation is not supported.
E/tflite (27005): 85 operations will run on the GPU, and the remaining 5 operations will run on the CPU.
I/tflite (27005): Replacing 85 node(s) with delegate (TfLiteGpuDelegateV2) node, yielding 2 partitions for the whole graph.
E/tflite (27005): Can not open OpenCL library on this device - undefined symbol: clGetCommandBufferInfoKHR
E/tflite (27005): Falling back to OpenGL
E/tflite (27005): TfLiteGpuDelegate Init: No shader implementation for transpose
I/tflite (27005): Created 0 GPU delegate kernels.
E/tflite (27005): TfLiteGpuDelegate Prepare: delegate is not initialized
E/tflite (27005): Node number 90 (TfLiteGpuDelegateV2) failed to prepare.
E/tflite (27005): Restored original execution plan after delegate application failure.
I/flutter (27005): Invalid argument(s): Unable to create interpreter

so i change GpuDelegateV2() to XNNPackDelegate() and it work

what is different between these two and do XNNPackDelegate() use GPU to infer model

@einsitang
Copy link

same issue to me

1 similar comment
@sakura-xiamu
Copy link

same issue to me

@czy10383
Copy link

czy10383 commented Oct 13, 2024

Hi, I encountered the same problem. I found the following sugggestion on tensorflow/tensorflow#60720 which resolved the issue for me

I added the following line to AndroidManifest.xml

<uses-library android:name="libOpenCL.so" android:required="false"/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants