How to pass mutable python objects to C++ ffi functions

Hi, i’m building a tvm ffi extension to integrate it with fastflow hpc parallel engine.

I cannot understand how to pass Mutable objects from python to c++

Maps and Arrays are immutable by default…

It would be nice to have also a mutable version.

one easy way to do that for now is to simply start by wrapping another custom ObjectRef with std::vector, feel free to also open an issue on the tvm-ffi repo

1 Like

i did not understand this sorry…

Can you expand on this?

i would be like to have Array and Map mutable

For now Array and Map are immutable atm, but one can create a new custom ObjectRef that wraps vector, Python Guide — tvm-ffi we can also look into bring mutable variant later, tracking here [FEAT] Support Mutable variant of Array · Issue #350 · apache/tvm-ffi · GitHub