asus4 / tf-lite-unity-sample

TensorFlow Lite Samples on Unity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gpu Accelerator not working for linux x86_64.

guts117 opened this issue · comments

  • OS/OS Version: Ubuntu 20.04.6
  • Source Version: master/v2.15.0
  • Unity Version: Unity 2022.3.11f1]

Hello. I am trying to use the libtensorflowlite_gpu_delegate.so for linux. But unity keeps giving me the following error:
DllNotFoundException: libtensorflowlite_gpu_delegate assembly:<unknown assembly> type:<unknown type> member:(null)

Also when I try to run build_tflite.py, I get the following error.

error: patch failed: tensorflow/lite/delegates/gpu/build_defs.bzl:24
error: tensorflow/lite/delegates/gpu/build_defs.bzl: patch does not apply

I have already install opengl es from the mediapipe link. Also managed to build the .so file with bazel directly or through the build_tflite.py program if I comment out the following two lines:

patch_file = os.path.abspath('Scripts/linux-gpu-delegate.patch')
run_cmd(f'git apply {patch_file}')

While I build properly from the above method. I still get the DllNotFoundException.

Thank you very much the amazing package, hopefully someone can help me out.

Solution: Adding this in tensorflow/tensorflow/lite/delegates/gpu/build_defs.bzl seems to make it work properly on linux.

"//conditions:default": [
            "-lEGL",
            "-lGLESv2",
        ],

The above fixes the issue.😁