Python bindingslink
Info
API reference pages for IREE's runtime and compiler Python APIs are hosted on readthedocs.
Overviewlink
IREE offers Python bindings split into several packages, covering different components:
PIP package name | Description |
---|---|
iree-compiler |
IREE's generic compiler tools and helpers |
iree-runtime |
IREE's runtime, including CPU and GPU backends |
iree-tools-tf |
Tools for importing from TensorFlow |
iree-tools-tflite |
Tools for importing from TensorFlow Lite |
iree-tools-xla |
Tools for importing from XLA |
iree-jax |
Tools for importing from JAX |
Collectively, these packages allow for importing from frontends, compiling towards various targets, and executing compiled code on IREE's backends.
Warning
The TensorFlow, TensorFlow Lite, and XLA packages are currently only available on Linux and macOS. They are not available on Windows yet (see this issue).
Prerequisiteslink
To use IREE's Python bindings, you will first need to install Python 3 and pip, as needed.
Tip
We recommend using virtual environments to manage python packages, such as
through venv
(about,
tutorial):
python -m venv .venv
source .venv/bin/activate
python -m venv .venv
.venv\Scripts\activate.bat
When done, run deactivate
.
Next, install packages:
python -m pip install --upgrade pip
python -m pip install numpy absl-py
Installing IREE packageslink
Prebuilt packageslink
Stable release packages are published to PyPI.
To install just the core IREE packages:
python -m pip install \
iree-compiler \
iree-runtime
To install IREE packages with tools for all frontends:
python -m pip install \
iree-compiler \
iree-runtime \
iree-tools-tf \
iree-tools-tflite \
iree-tools-xla
Tip
Nightly packages are also published on
GitHub releases. To use these,
run pip install
with this extra option:
--find-links https://iree-org.github.io/iree/pip-release-links.html
Building from sourcelink
See Building Python bindings page for instructions for building from source.
Using the Python bindingslink
API reference pages for IREE's runtime and compiler Python APIs are hosted on readthedocs.
Check out the samples in IREE's samples/colab/ directory and the iree-samples repository for examples using the Python APIs.