Info
I'm using Tensorflow-Lite in Android's Native environment via the C-API (following these instructions) but runtime is significantly longer compared to the GPU delegate via the Java API (on ART).
The JNI AAR file (2.2) offers C-headers and a shared-library, but it seems that the shared-library doesn't contain the GPU delegate, but only a framework to configure delegates on (TfLiteDelegate object and TfLiteDelegateCreate()).
** It doesn't provide any TfLiteGpuDelegateV2Create() or tflite namespace access, for example.
Trials
- I've tried to include a
libtensorflowlite_gpu_delegate.soin the project with cmake but though it seems to build and link OK - the library isn't accessible via Native code. - I tried following c_api.h's example of delegate usage, but I can't seem to configure a GPU delegate.
- Docker container doesn't include toolchain (trying to build shared library in tensorflow/tensorflow:latest-devel-gpu Tensorflow Docker image with
bazel build -c opt --config android_arm64 tensorflow/lite/delegates/gpu:libtensorflowlite_gpu_delegate.sofails withcc_toolchain_suite '@local_config_cc//:toolchain' does not contain a toolchain for cpu 'arm64-v8a')
Question
How can I run an inference with the GPU delegate in Android's Native environment using the C-API?