Skip to content
Advertisement

Tag: pybind11

pybind11 crashes (segmentation fault (core dumped)) while importing ONNX python module

I am using pybind11 in my C++ code. When I try to import onnx, my code crashes with Segmentation fault (core dumped). However, if I import onnxruntime, everything is well. Of course both onnx and onnxruntime are installed on my system via pip. The order of the import lines is irrelevant. Wherever it is, py::module::import(“onnx”) crashes with segmentation fault. How

How to set python function as callback for c++ using pybind11?

It is from SDK which I can call the client from dynamic library in c++ codes. I want to port it to python bindings use pybind11. How do I set_callback in python? I have seen the doc and try: The code just failed to compile. My question, how do I convert the py::function to ftype_callback or there is other way

undefined symbol: _PyThreadState_Current when using pybind wrapped C++ code

When I’m running bazel test … the cpp code will compile, but Python gets stuck. I read these before I wrote this question, but I can not find any solution: https://github.com/pybind/pybind11/issues/314 undefined symbol: _PyThreadState_Current when importing tensorflow https://github.com/carla-simulator/ros-bridge/issues/368 https://python-forum.io/thread-32297.html OS: Linux 5.11.0-43-generic #47~20.04.2-Ubuntu SMP Mon Dec 13 11:06:56 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux Python: Python 3.8.10 g++: g++ (Ubuntu

pybind11 modify numpy array from C++

EDIT: It works now, I do not know why. Don’t think I changed anything I want to pass in and modify a large numpy array with pybind11. Because it’s large I want to avoid copying it and returning a new one. Here’s the code: I think the py::array::forcecast is causing a conversion and so leaving the input matrix unmodified (in

Advertisement