Samsung / ONE

On-device Neural Engine
Other
438 stars 157 forks source link

[cirlce-interpreter] Run luci-interpreter in python directly #14352

Open mhs4670go opened 9 hours ago

mhs4670go commented 9 hours ago

What

Let's introduce a library to run circle-interpreter in python directly.

Why

As part of the work to make our ONE tools python friendly, running circle-interpreter in python directly is a good first step.

If a circle binary is being in the memory, it should be exported first to .circle file to run circle-interpreter because circle-interpreter only receive a circle file path.

This flow has a few problems. First, even though users just want to run circle model with numpy arrays in python interpreter, the flow forces users to dump circle file. Second, then, circle-interpreter re-loads the circle file for the inference, which causes to take double memory: the circle binary in python interpreter and the one in circle-interperter.

There is ctypes python library that allows calling c or c++ functions in DLLs or shared libraries directly. I'm going to introduce a library in circle-interpreter that can be used in python interpreter with ctypes library.