Passing mlx::core::array from C++ to Python — TypeError: Unable to convert function return value to a Python type!
#2793
Unanswered
codeSamuraii
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm trying to pass C++
mlx::core::arrayobjects to Python viananobindbindings, but I get the following error:The documentation suggests that I can return
mlx::core::arrayobjects directly from the bindings, but I haven't been able to pass C++ MLX arrays without explicitly usingnb::ndarrayor memviews.I made a basic example to illustrate the issue.
Project Structure
Code
src/bindings.cpp - The bindings import
mlx.corefirst thing during module initializationsrc/example.cpp - Functions returning
mlx::core::arraymlx_example/__init__.py
Build Configuration
CMakeLists.txt
pyproject.toml:
Build output
Click to view build logs
Script output
The documentation mentions importing
mlx.corebefore the extension, which I do.Is there an error in my configuration? Any help would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions