IREE has Python bindings geared towards lower level compiler interop that are not intended to be a public API, and integration with Python frontends such as TensorFlow.
We do not yet provide a pip package for easy installation, so to use IREE's Python bindings you must build from source.
You should already have IREE cloned and building on your machine. See the other getting started guides for instructions.
Note:
Support is best with Bazel. For CMake (excluding TensorFlow), set theIREE_BUILD_PYTHON_BINDINGS
option.
Install a recent version of Python 3 and pip, if needed.
Install packages:
$ python3 -m pip install --upgrade pip $ python3 -m pip install numpy # If using the TensorFlow integration $ python3 -m pip install tf-nightly
To run tests for core Python bindings built with CMake:
$ cd build $ ctest -L bindings/python
To run tests for core Python bindings built with Bazel:
$ bazel test bindings/python/...
To run tests for the TensorFlow integration, which include end-to-end backend comparison tests:
# Exclude tests that are skipped in the Kokoro CI $ bazel test \ --build_tag_filters="-nokokoro" \ --test_tag_filters="-nokokoro" \ --define=iree_tensorflow=true \ integrations/tensorflow/...
See start_colab_kernel.py and Using Colab for setup instructions, then take a look through the Colab directory for some sample notebooks.