Comments (6)
Hi @eltimen,
Enabling GPU support requires additional libraries and dependencies related to OpenCL. This might be the reason for
the error tflite::gpu::gl and tflite::gpu::OptionalAndroidHardwareBuffer
. Please try to add the following to the Android manifest in order to detect GPU delegate.
<uses-library android:name="libOpenCL.so"
android:required="false"/>
<uses-library android:name="libOpenCL-pixel.so"
android:required="false"/>
Also Verify that the NDK version (r25b) is compatible with the TensorFlow Lite version you are trying to build.
Thank You
from tensorflow.
I'm not using Gradle or Android Studio. I just tried to build libtensorflow-lite.so
for Android using CMake following the documentation and I got the linker errors above.
I tried to build it with Bazel as mentioned here and build was successful. According to this page NDK r25b should be compatible with this TFLite version.
According to the documentation, TensorFlow Lite supports both ways to build it for Android: with CMake and with Bazel. Looks like CMake building is broken with enabled GPU delegate in this version.
from tensorflow.
This looks like a duplicate of #65744, investigating.
from tensorflow.
Hi @eltimen, I was able to build fine with these steps:
git clone https://github.com/tensorflow/tensorflow.git tensorflow_src
cd tensorflow_src
git switch r2.16
cd ..
mkdir tflite_build
cd tflite_build
cmake -S ../tensorflow_src/tensorflow/lite -B build -D CMAKE_BUILD_TYPE=Release -D CMAKE_SYSTEM_PROCESSOR=aarch64 -D BUILD_SHARED_LIBS=ON -D TFLITE_ENABLE_GPU=ON -D CMAKE_SYSTEM_NAME=Linux -D CMAKE_SYSTEM_VERSION=29 -D ANDROID_PLATFORM=29 -D CMAKE_ANDROID_ARCH_ABI=arm64-v8a -D ANDROID_ABI=arm64-v8a -D CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake
Please note $ANDROID_NDK is the path to my NDK, which is 25b.
I am building on MacOS, you didn't specify an OS so that could be an issue.
Can you please let us know what OS you are using? Additionally please review my reproduce steps and let me know if I did something different than what you are doing? Thanks.
from tensorflow.
Hi @pkgoogle, I use Ubuntu 22.04.
I'm building TFLite from the tag v2.16.1
, but you are building it from the branch r2.16
.
Can you try to reproduce this using the release 2.16.1 version?
from tensorflow.
Hi @eltimen, I am using a Debian system, and went to that tag, but am using NDK=r25c, I am still not reproducing the error:
git clone https://github.com/tensorflow/tensorflow.git tensorflow_src
cd tensorflow_src
git checkout v2.16.1
cd ..
mkdir tflite_build
cd tflite_build
cmake -S ../tensorflow_src/tensorflow/lite -B build -D CMAKE_BUILD_TYPE=Release -D CMAKE_SYSTEM_PROCESSOR=aarch64 -D BUILD_SHARED_LIBS=ON -D TFLITE_ENABLE_GPU=ON -D CMAKE_SYSTEM_NAME=Linux -D CMAKE_SYSTEM_VERSION=29 -D ANDROID_PLATFORM=29 -D CMAKE_ANDROID_ARCH_ABI=arm64-v8a -D ANDROID_ABI=arm64-v8a -D CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake
It looks like my Clang is different (14.0.7) probably from the different r25c.
Can you try with a fresh repo, perhaps fresh NDK, and ensure you follow the same steps exactly? Let me know if somehow that resolves your issue.
from tensorflow.
Related Issues (20)
- TensorFlow lite Whisper model get worse inference result. HOT 1
- Not getting the same result when using .tflite in C and Python.
- Math problem HOT 1
- Cannot import tflite_support.task when tensorflow is installed HOT 2
- Incapable of loading a tf v1 model
- Action of the matrix exponential on vectors HOT 2
- Fetch HOT 1
- XNNPACK delegate doesn't support to broadcast last dimension for Prelu operator HOT 1
- Failing Tensorflow unit tests for BF16 hardware
- Interpreter in Swift fails with `EXC_BAD_ACCESS` at `Interpreter.copy(data, toInputAt: 0)` and `Interpreter.input(at: 0)` in some circumstances HOT 1
- Could not find any nvml.h during building from source in docker HOT 1
- Configurable attribute "deps" in @XNNPACK//:prod_microkernels doesn't match this configuration
- benchmark_model no longer cross-compiles for Android from macOS HOT 1
- Inference time using Interpreter API on Android inconsistent and 10–50 times slower than same tflite model on iOS HOT 9
- Basic regression: Predict fuel efficiency Probelm HOT 3
- [
- [Question] Is it possibile to use `jit_compile=True` (XLA) when input is a string? HOT 4
- Homepage sections displaying incorrectly on TensorFlow website HOT 3
- Wrong quantized_dimension (axis) when "per-channel" quantization
- tf.function deadlock with multiple multiprocess/threading HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tensorflow.