Skip to content

Building Desktop binaries with XNNPack Delegate

Amish Garg edited this page Jun 14, 2021 · 4 revisions

Examples with Desktop Support


Instructions to build desktop binaries

Clone the TensorFlow repository

git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
git checkout r2.5

Checkout to any tensorflow version using git checkout r<version>

Build using bazel

  • These steps will generate tensorflow binary based on platform you are using to build.

  • To install bazel refer this guide.

  • Execute the build command in tensorflow directory root.

    bazel build -c opt //tensorflow/lite/c:tensorflowlite_c --define tflite_with_xnnpack=true

  • The generated shared library will be available in your bazel-bin/tensorflow/lite/c directory.

The exact output library name is platform dependent:

  • Linux: libtensorflowlite_c.so
  • Mac: libtensorflowlite_c.dylib
  • Windows: tensorflowlite_c.dll

Rename it to:

  • Linux: libtensorflowlite_c-linux.so
  • Mac: libtensorflowlite_c-mac.dylib
  • Windows: libtensorflowlite_c-win.dll

Place the renamed binary in <your-project-root>/blobs/