title: Using Tensorflow-Lite GPU delegate in Android's Native environment with C-API
body: <h3>Info</h3>
  <p>I'm using Tensorflow-Lite in Android's Native environment via the C-API (following <a href="https://www.tensorflow.org/lite/guide/android#use_tflite_c_api" rel="nofollow noreferrer">these instructions</a>) but runtime is significantly longer compared to the GPU delegate via the Java API (on ART).</p>
  <p>The <a href="https://bintray.com/google/tensorflow/tensorflow-lite#files/org%2Ftensorflow%2Ftensorflow-lite%2F2.2.0" rel="nofollow noreferrer">JNI AAR file (2.2)</a> 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 (<code>TfLiteDelegate</code> object and <code>TfLiteDelegateCreate()</code>).</p>
  <p>** It doesn't provide any <code>TfLiteGpuDelegateV2Create()</code> or <code>tflite</code> namespace access, for example.</p>
  <h3>Trials</h3>
  <ul>
  <li>I've tried to include a <code>libtensorflowlite_gpu_delegate.so</code> in the project with <strong>cmake</strong> but though it seems to build and link OK - the library isn't accessible via Native code.</li>
  <li>I tried following <a href="https://github.com/tensorflow/tensorflow/blob/7a93fd22f78231a64abb212dffa15d9749da1281/tensorflow/lite/c/c_api.h" rel="nofollow noreferrer">c_api.h</a>'s example of delegate usage, but I can't seem to configure a GPU delegate.</li>
  <li>Docker container doesn't include toolchain (trying to build shared library in <a href="https://hub.docker.com/layers/tensorflow/tensorflow/latest-devel-gpu/images/sha256-a5d4548223d0949503efe9bb3ef8ec29e51eeca1a347afe8485aacc9d0ca31da?context=explore" rel="nofollow noreferrer">tensorflow/tensorflow:latest-devel-gpu</a> Tensorflow Docker image with <code>bazel build -c opt --config android_arm64 tensorflow/lite/delegates/gpu:libtensorflowlite_gpu_delegate.so</code> fails with <code>cc_toolchain_suite '@local_config_cc//:toolchain' does not contain a toolchain for cpu 'arm64-v8a'</code>)</li>
  </ul>
  <h3>Question</h3>
  <p>How can I run an inference with the <strong>GPU delegate</strong> in Android's <strong>Native</strong> environment using the <strong>C-API</strong>?</p>