# Apply Tensorflow model on pynq?

**URL:** <https://discuss.pynq.io/t/apply-tensorflow-model-on-pynq/1771>\
**Category:** Support\
**Created:** [September 20, 2020, 6:10am UTC](https://discuss.pynq.io/t/apply-tensorflow-model-on-pynq/1771 "2020-09-20T06:10:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nfmzl](https://avatars.discourse-cdn.com/v4/letter/n/dbc845/32.png) [@nfmzl](https://discuss.pynq.io/u/nfmzl)\
**Post date:** [September 20, 2020, 6:10am UTC](https://discuss.pynq.io/t/apply-tensorflow-model-on-pynq/1771/1 "2020-09-20T06:10:18Z")

</div>

Hello everyone,

I have just trained a model using Tensorflow in my PC and I would like to apply it on my PYNQ-Z2. However, I found that Tensorflow 1.0+ versions cannot be installed on PYNQ-Z2, and I also failed to install opencv-contrib.

Is there any way for us to load and run a Tensorflow model on PYNQ-Z2? Or do I need to buy a Ultra96?

---

<div class="post-metadata">

**Author:** ![rock](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/rock/32/32_2.png) [@rock](https://discuss.pynq.io/u/rock)\
**Post date:** [September 21, 2020, 4:07pm UTC](https://discuss.pynq.io/t/apply-tensorflow-model-on-pynq/1771/2 "2020-09-21T16:07:59Z")

</div>

Tensorflow is too heavy to install but tflite should be working. Personally I tried tflite and it is working on one of our boards (you perhaps need bazel, but I don’t remember).

---

<div class="post-metadata">

**Author:** ![quentonh](https://avatars.discourse-cdn.com/v4/letter/q/f04885/32.png) [@quentonh](https://discuss.pynq.io/u/quentonh)\
**Post date:** [September 29, 2020, 2:37pm UTC](https://discuss.pynq.io/t/apply-tensorflow-model-on-pynq/1771/3 "2020-09-29T14:37:48Z")

</div>

@nfmzl @rock

Despite that this is a Pynq-Z2, is another option to leverage DPU-PYNQ in conjunction with TVM, assuming that nfmzl can port DPU-PYNQ to the Z2?

[https://github.com/Xilinx/Vitis-AI/tree/master/tvm](https://github.com/Xilinx/Vitis-AI/tree/master/tvm)

> **[GitHub - Xilinx/DPU-PYNQ: DPU on PYNQ](https://github.com/Xilinx/DPU-PYNQ)**
>
> DPU on PYNQ. Contribute to Xilinx/DPU-PYNQ development by creating an account on GitHub.

You should also be able to consider use of the TVM runtime / compiler with no DPU. I would assume that in this context you would use the TVM main repository (see tvm.ai) to directly target the A53 for inference acceleration.

TVM solves the problem of deployment of models that originate from framework versions that are not supported directly in Vitis-AI, and should likewise solve the problem of TF compatibility with PYNQ.

My 2 cents…  
–Quenton

---

<div class="post-metadata">

**Author:** ![thomasvz](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/thomasvz/32/1685_2.png) [@thomasvz](https://discuss.pynq.io/u/thomasvz)\
**Post date:** [January 5, 2021, 10:11am UTC](https://discuss.pynq.io/t/apply-tensorflow-model-on-pynq/1771/4 "2021-01-05T10:11:28Z")

</div>

Hello, could you tell me which version of tflite you are running? I’m currently trying to run tflite\_runtime-2.5.0 on the PYNQ-Z2 V2.5 image but the interpreter is unfortunatly not running correctly (Illegal Intruction on invoke).  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![rock](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/rock/32/32_2.png) [@rock](https://discuss.pynq.io/u/rock)\
**Post date:** [January 5, 2021, 4:25pm UTC](https://discuss.pynq.io/t/apply-tensorflow-model-on-pynq/1771/5 "2021-01-05T16:25:49Z")

</div>

I don’t remember the version, but it should be much less than 2.5.0. There is a bazel package in sdbuild folder on PYNQ github, I think I used the version compatible with that bazel package.

---

<div class="post-metadata">

**Author:** ![Lotfi](https://avatars.discourse-cdn.com/v4/letter/l/48db29/32.png) [@Lotfi](https://discuss.pynq.io/u/Lotfi)\
**Post date:** [September 16, 2022, 7:21am UTC](https://discuss.pynq.io/t/apply-tensorflow-model-on-pynq/1771/6 "2022-09-16T07:21:11Z")

</div>

Hello @thomasvz I am facing a similar issue with PYNQ Z1 v2.7 image on interpreter.invoke did you find any solution?  
Thank you in advance!
