# ONNX for passing model to OpenFHE mathematics

**URL:** <https://openfhe.discourse.group/t/onnx-for-passing-model-to-openfhe-mathematics/549>\
**Category:** FHE Use Cases\
**Created:** [May 15, 2023, 8:49am UTC](https://openfhe.discourse.group/t/onnx-for-passing-model-to-openfhe-mathematics/549 "2023-05-15T08:49:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![LHenke](https://avatars.discourse-cdn.com/v4/letter/l/c0e974/32.png) [@LHenke](https://openfhe.discourse.group/u/LHenke)\
**Post date:** [May 15, 2023, 8:49am UTC](https://openfhe.discourse.group/t/onnx-for-passing-model-to-openfhe-mathematics/549/1 "2023-05-15T08:49:17Z")

</div>

Hello everyone,

I am currently working on developing a framework for doing encrypted inference using OpenFHE. For this I want to have the possibility to feed an ONNX model file to this software and let OpenFHE handle the ML operations of the model. Now that means that I just need a tool from which I can extract the models layers and the underlying parameters and feed that information to my OpenFHE inference library without really using the full ONNX runtime which has it’s own hardware acceleration techniques to carry out these operations. Does anyone know of such a tool, which I can easily include into my CMake project?

Cheers and thanks in advance

PS: I don’t know if this is the proper category for this question. If you do not think so feel free to change it or let me know.

---

<div class="post-metadata">

**Author:** ![iquah](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/iquah/32/8_2.png) [@iquah](https://openfhe.discourse.group/u/iquah)\
**Post date:** [May 15, 2023, 5:11pm UTC](https://openfhe.discourse.group/t/onnx-for-passing-model-to-openfhe-mathematics/549/2 "2023-05-15T17:11:27Z")

</div>

I’d say probably not - OpenFHE is a relatively young library and deep learning inference is still active work. You might need to write something on your own

---

<div class="post-metadata">

**Author:** ![LHenke](https://avatars.discourse-cdn.com/v4/letter/l/c0e974/32.png) [@LHenke](https://openfhe.discourse.group/u/LHenke)\
**Post date:** [June 9, 2023, 11:10am UTC](https://openfhe.discourse.group/t/onnx-for-passing-model-to-openfhe-mathematics/549/3 "2023-06-09T11:10:14Z")

</div>

Thanks for your response. The way I am doing it right now is to just write python wrappers around my C++ code and then just use python to handle the machine learning set up.

---

<div class="post-metadata">

**Author:** ![iquah](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/iquah/32/8_2.png) [@iquah](https://openfhe.discourse.group/u/iquah)\
**Post date:** [June 9, 2023, 1:33pm UTC](https://openfhe.discourse.group/t/onnx-for-passing-model-to-openfhe-mathematics/549/4 "2023-06-09T13:33:29Z")

</div>

Well this is an open source community so please feel free to share your project (especially the ONNX converter) in our show-and-tell 🙂

---

<div class="post-metadata">

**Author:** ![LHenke](https://avatars.discourse-cdn.com/v4/letter/l/c0e974/32.png) [@LHenke](https://openfhe.discourse.group/u/LHenke)\
**Post date:** [June 13, 2023, 8:34am UTC](https://openfhe.discourse.group/t/onnx-for-passing-model-to-openfhe-mathematics/549/5 "2023-06-13T08:34:13Z")

</div>

I will, once I have something running. But I did not write a converter for onnx, I am just porting my OpenFHE code to a Python library with [Pybind11](https://pybind11.readthedocs.io/en/stable/#), so that (also among other reasons) I can use the onnx libraries provided in Python 🙂

---

<div class="post-metadata">

**Author:** ![iquah](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/iquah/32/8_2.png) [@iquah](https://openfhe.discourse.group/u/iquah)\
**Post date:** [June 13, 2023, 6:53pm UTC](https://openfhe.discourse.group/t/onnx-for-passing-model-to-openfhe-mathematics/549/6 "2023-06-13T18:53:33Z")

</div>

Judy a heads up we actually have a WIP python pybind11 port, so if you’d like to collaborate please let us know!

> **[GitHub - openfheorg/openfhe-python: Work In Progress: Official Python wrapper...](https://github.com/openfheorg/openfhe-python)**
>
> Work In Progress: Official Python wrapper for OpenFHE - GitHub - openfheorg/openfhe-python: Work In Progress: Official Python wrapper for OpenFHE
