From 8be9cf2fc57a88c40290a90cbca6890aa8b6cd0b Mon Sep 17 00:00:00 2001 From: Olivier BICHLER <olivier.bichler@cea.fr> Date: Mon, 23 Oct 2023 10:33:50 +0200 Subject: [PATCH] Operator binding hotfix --- .../backend/pybind_OperatorImpl.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/python_binding/backend/pybind_OperatorImpl.cpp b/python_binding/backend/pybind_OperatorImpl.cpp index 8eb9e2649..346100690 100644 --- a/python_binding/backend/pybind_OperatorImpl.cpp +++ b/python_binding/backend/pybind_OperatorImpl.cpp @@ -12,6 +12,7 @@ #include <pybind11/pybind11.h> #include <pybind11/stl.h> +#include "aidge/operator/Operator.hpp" #include "aidge/backend/OperatorImpl.hpp" namespace py = pybind11; @@ -22,8 +23,8 @@ namespace Aidge { * */ class pyOperatorImpl: public OperatorImpl { - public: - pyOperatorImpl(){} +public: + using OperatorImpl::OperatorImpl; // Inherit constructors void forward() override { PYBIND11_OVERRIDE( @@ -42,7 +43,7 @@ class pyOperatorImpl: public OperatorImpl { ); } NbElts_t getNbRequiredData(const IOIndex_t inputIdx) const override { - PYBIND11_OVERRIDE_PURE_NAME( + PYBIND11_OVERRIDE_NAME( NbElts_t, OperatorImpl, "get_nb_required_data", @@ -51,7 +52,7 @@ class pyOperatorImpl: public OperatorImpl { ); } NbElts_t getNbRequiredProtected(const IOIndex_t inputIdx) const override { - PYBIND11_OVERRIDE_PURE_NAME( + PYBIND11_OVERRIDE_NAME( NbElts_t, OperatorImpl, "get_nb_required_protected", @@ -62,7 +63,7 @@ class pyOperatorImpl: public OperatorImpl { } NbElts_t getRequiredMemory(const IOIndex_t outputIdx, const std::vector<DimSize_t> &inputsSize) const override { - PYBIND11_OVERRIDE_PURE_NAME( + PYBIND11_OVERRIDE_NAME( NbElts_t, OperatorImpl, "get_required_memory", @@ -73,7 +74,7 @@ class pyOperatorImpl: public OperatorImpl { ); } NbElts_t getNbConsumedData(const IOIndex_t inputIdx) const override { - PYBIND11_OVERRIDE_PURE_NAME( + PYBIND11_OVERRIDE_NAME( NbElts_t, OperatorImpl, "get_nb_consumed_data", @@ -83,7 +84,7 @@ class pyOperatorImpl: public OperatorImpl { ); } NbElts_t getNbProducedData(const IOIndex_t outputIdx) const override { - PYBIND11_OVERRIDE_PURE_NAME( + PYBIND11_OVERRIDE_NAME( NbElts_t, OperatorImpl, "get_nb_produced_data", @@ -93,7 +94,7 @@ class pyOperatorImpl: public OperatorImpl { ); } void updateConsummerProducer() override { - PYBIND11_OVERRIDE_PURE_NAME( + PYBIND11_OVERRIDE_NAME( void, OperatorImpl, "update_consummer_producer", @@ -106,7 +107,7 @@ class pyOperatorImpl: public OperatorImpl { void init_OperatorImpl(py::module& m){ py::class_<OperatorImpl, std::shared_ptr<OperatorImpl>, pyOperatorImpl>(m, "OperatorImpl", py::dynamic_attr()) - .def(py::init<>()) + .def(py::init<const Operator&>()) .def("forward", &OperatorImpl::forward) .def("backward", &OperatorImpl::backward) .def("get_nb_required_data", &OperatorImpl::getNbRequiredData) -- GitLab