From 6e6d2e110757cd161218eb2d54564b2e8b0034ab Mon Sep 17 00:00:00 2001 From: NAUD Maxence <maxence.naud@cea.fr> Date: Thu, 21 Mar 2024 17:07:38 +0000 Subject: [PATCH] Fix python binding and add Tensor.hpp in includes for opertors --- python_binding/backend/pybind_OperatorImpl.cpp | 3 ++- python_binding/operator/pybind_Add.cpp | 1 + python_binding/operator/pybind_AvgPooling.cpp | 1 + python_binding/operator/pybind_BatchNorm.cpp | 1 + python_binding/operator/pybind_Concat.cpp | 1 + python_binding/operator/pybind_Conv.cpp | 1 + python_binding/operator/pybind_ConvDepthWise.cpp | 1 + python_binding/operator/pybind_Div.cpp | 1 + python_binding/operator/pybind_Erf.cpp | 1 + python_binding/operator/pybind_FC.cpp | 3 ++- python_binding/operator/pybind_Gather.cpp | 1 + python_binding/operator/pybind_GenericOperator.cpp | 1 + python_binding/operator/pybind_Identity.cpp | 1 + python_binding/operator/pybind_LeakyReLU.cpp | 1 + python_binding/operator/pybind_Matmul.cpp | 3 ++- python_binding/operator/pybind_MaxPooling.cpp | 2 +- python_binding/operator/pybind_Mul.cpp | 1 + python_binding/operator/pybind_Operator.cpp | 4 +++- python_binding/operator/pybind_OperatorTensor.cpp | 2 ++ python_binding/operator/pybind_Pad.cpp | 3 ++- python_binding/operator/pybind_Pop.cpp | 1 + python_binding/operator/pybind_Pow.cpp | 1 + python_binding/operator/pybind_Producer.cpp | 4 ++-- python_binding/operator/pybind_ReLU.cpp | 1 + python_binding/operator/pybind_ReduceMean.cpp | 3 ++- python_binding/operator/pybind_Reshape.cpp | 1 + python_binding/operator/pybind_Sigmoid.cpp | 1 + python_binding/operator/pybind_Slice.cpp | 1 + python_binding/operator/pybind_Softmax.cpp | 1 + python_binding/operator/pybind_Sqrt.cpp | 1 + python_binding/operator/pybind_Sub.cpp | 1 + python_binding/operator/pybind_Tanh.cpp | 1 + python_binding/operator/pybind_Transpose.cpp | 4 ++-- 33 files changed, 43 insertions(+), 11 deletions(-) diff --git a/python_binding/backend/pybind_OperatorImpl.cpp b/python_binding/backend/pybind_OperatorImpl.cpp index 91d65484a..4574bd8f8 100644 --- a/python_binding/backend/pybind_OperatorImpl.cpp +++ b/python_binding/backend/pybind_OperatorImpl.cpp @@ -11,6 +11,7 @@ #include <pybind11/pybind11.h> #include <pybind11/stl.h> +#include <string> #include "aidge/operator/Operator.hpp" #include "aidge/backend/OperatorImpl.hpp" @@ -116,7 +117,7 @@ public: void init_OperatorImpl(py::module& m){ py::class_<OperatorImpl, std::shared_ptr<OperatorImpl>, pyOperatorImpl>(m, "OperatorImpl", py::dynamic_attr()) - .def(py::init<const Operator&>(), py::keep_alive<1, 1>(), py::keep_alive<1, 2>()) + .def(py::init<const Operator&, const std::string&>(), py::keep_alive<1, 1>(), py::keep_alive<1, 2>()) .def("forward", &OperatorImpl::forward) .def("backward", &OperatorImpl::backward) .def("get_nb_required_data", &OperatorImpl::getNbRequiredData) diff --git a/python_binding/operator/pybind_Add.cpp b/python_binding/operator/pybind_Add.cpp index 661c96bb8..c3eeb192a 100644 --- a/python_binding/operator/pybind_Add.cpp +++ b/python_binding/operator/pybind_Add.cpp @@ -12,6 +12,7 @@ #include <pybind11/pybind11.h> #include "aidge/operator/Add.hpp" +#include "aidge/data/Tensor.hpp" #include "aidge/backend/OperatorImpl.hpp" #include "aidge/operator/OperatorTensor.hpp" #include "aidge/utils/Types.h" diff --git a/python_binding/operator/pybind_AvgPooling.cpp b/python_binding/operator/pybind_AvgPooling.cpp index c44c7b49a..ab52472b4 100644 --- a/python_binding/operator/pybind_AvgPooling.cpp +++ b/python_binding/operator/pybind_AvgPooling.cpp @@ -17,6 +17,7 @@ #include <array> #include "aidge/backend/OperatorImpl.hpp" +#include "aidge/data/Tensor.hpp" #include "aidge/operator/AvgPooling.hpp" #include "aidge/operator/OperatorTensor.hpp" #include "aidge/utils/Types.h" diff --git a/python_binding/operator/pybind_BatchNorm.cpp b/python_binding/operator/pybind_BatchNorm.cpp index 7020c35f6..87e444bbc 100644 --- a/python_binding/operator/pybind_BatchNorm.cpp +++ b/python_binding/operator/pybind_BatchNorm.cpp @@ -12,6 +12,7 @@ #include <pybind11/pybind11.h> #include <string> +#include "aidge/data/Tensor.hpp" #include "aidge/operator/BatchNorm.hpp" #include "aidge/operator/OperatorTensor.hpp" #include "aidge/utils/Types.h" diff --git a/python_binding/operator/pybind_Concat.cpp b/python_binding/operator/pybind_Concat.cpp index 38d8a20cb..756686c20 100644 --- a/python_binding/operator/pybind_Concat.cpp +++ b/python_binding/operator/pybind_Concat.cpp @@ -12,6 +12,7 @@ #include <pybind11/pybind11.h> #include <string> +#include "aidge/data/Tensor.hpp" #include "aidge/operator/Concat.hpp" #include "aidge/operator/OperatorTensor.hpp" diff --git a/python_binding/operator/pybind_Conv.cpp b/python_binding/operator/pybind_Conv.cpp index aea402017..cd20750b3 100644 --- a/python_binding/operator/pybind_Conv.cpp +++ b/python_binding/operator/pybind_Conv.cpp @@ -16,6 +16,7 @@ #include <array> #include "aidge/backend/OperatorImpl.hpp" +#include "aidge/data/Tensor.hpp" #include "aidge/operator/Conv.hpp" #include "aidge/operator/OperatorTensor.hpp" #include "aidge/utils/Types.h" diff --git a/python_binding/operator/pybind_ConvDepthWise.cpp b/python_binding/operator/pybind_ConvDepthWise.cpp index 83eac8742..a136a7a4f 100644 --- a/python_binding/operator/pybind_ConvDepthWise.cpp +++ b/python_binding/operator/pybind_ConvDepthWise.cpp @@ -17,6 +17,7 @@ #include <array> #include "aidge/backend/OperatorImpl.hpp" +#include "aidge/data/Tensor.hpp" #include "aidge/operator/ConvDepthWise.hpp" #include "aidge/operator/OperatorTensor.hpp" #include "aidge/utils/Types.h" diff --git a/python_binding/operator/pybind_Div.cpp b/python_binding/operator/pybind_Div.cpp index 2996e0bca..e9bf26b62 100644 --- a/python_binding/operator/pybind_Div.cpp +++ b/python_binding/operator/pybind_Div.cpp @@ -11,6 +11,7 @@ #include <pybind11/pybind11.h> +#include "aidge/data/Tensor.hpp" #include "aidge/operator/Div.hpp" #include "aidge/operator/OperatorTensor.hpp" diff --git a/python_binding/operator/pybind_Erf.cpp b/python_binding/operator/pybind_Erf.cpp index e1aef08ad..c5fd53f2a 100644 --- a/python_binding/operator/pybind_Erf.cpp +++ b/python_binding/operator/pybind_Erf.cpp @@ -11,6 +11,7 @@ #include <pybind11/pybind11.h> +#include "aidge/data/Tensor.hpp" #include "aidge/operator/Erf.hpp" #include "aidge/operator/OperatorTensor.hpp" diff --git a/python_binding/operator/pybind_FC.cpp b/python_binding/operator/pybind_FC.cpp index 0b13643cb..ab1ed9ce2 100644 --- a/python_binding/operator/pybind_FC.cpp +++ b/python_binding/operator/pybind_FC.cpp @@ -11,8 +11,9 @@ #include <pybind11/pybind11.h> -#include "aidge/operator/FC.hpp" #include "aidge/backend/OperatorImpl.hpp" +#include "aidge/data/Tensor.hpp" +#include "aidge/operator/FC.hpp" #include "aidge/operator/OperatorTensor.hpp" #include "aidge/utils/Types.h" diff --git a/python_binding/operator/pybind_Gather.cpp b/python_binding/operator/pybind_Gather.cpp index db6bdb15a..8c32acfe2 100644 --- a/python_binding/operator/pybind_Gather.cpp +++ b/python_binding/operator/pybind_Gather.cpp @@ -12,6 +12,7 @@ #include <pybind11/pybind11.h> #include <string> +#include "aidge/data/Tensor.hpp" #include "aidge/operator/Gather.hpp" #include "aidge/operator/OperatorTensor.hpp" diff --git a/python_binding/operator/pybind_GenericOperator.cpp b/python_binding/operator/pybind_GenericOperator.cpp index a5435a3ce..31ee946fc 100644 --- a/python_binding/operator/pybind_GenericOperator.cpp +++ b/python_binding/operator/pybind_GenericOperator.cpp @@ -15,6 +15,7 @@ #include <stdio.h> #include "aidge/backend/OperatorImpl.hpp" +#include "aidge/data/Tensor.hpp" #include "aidge/operator/GenericOperator.hpp" #include "aidge/operator/OperatorTensor.hpp" namespace py = pybind11; diff --git a/python_binding/operator/pybind_Identity.cpp b/python_binding/operator/pybind_Identity.cpp index b1b1e8888..4538b72fc 100644 --- a/python_binding/operator/pybind_Identity.cpp +++ b/python_binding/operator/pybind_Identity.cpp @@ -11,6 +11,7 @@ #include <pybind11/pybind11.h> +#include "aidge/data/Tensor.hpp" #include "aidge/operator/Identity.hpp" #include "aidge/operator/Operator.hpp" diff --git a/python_binding/operator/pybind_LeakyReLU.cpp b/python_binding/operator/pybind_LeakyReLU.cpp index 66b2c34a9..9ad47e7a3 100644 --- a/python_binding/operator/pybind_LeakyReLU.cpp +++ b/python_binding/operator/pybind_LeakyReLU.cpp @@ -11,6 +11,7 @@ #include <pybind11/pybind11.h> +#include "aidge/data/Tensor.hpp" #include "aidge/operator/LeakyReLU.hpp" #include "aidge/operator/OperatorTensor.hpp" diff --git a/python_binding/operator/pybind_Matmul.cpp b/python_binding/operator/pybind_Matmul.cpp index 383bad54b..73bfac04a 100644 --- a/python_binding/operator/pybind_Matmul.cpp +++ b/python_binding/operator/pybind_Matmul.cpp @@ -11,8 +11,9 @@ #include <pybind11/pybind11.h> -#include "aidge/operator/MatMul.hpp" #include "aidge/backend/OperatorImpl.hpp" +#include "aidge/data/Tensor.hpp" +#include "aidge/operator/MatMul.hpp" #include "aidge/operator/OperatorTensor.hpp" #include "aidge/utils/Types.h" diff --git a/python_binding/operator/pybind_MaxPooling.cpp b/python_binding/operator/pybind_MaxPooling.cpp index 8a5e3db9d..91fa0489d 100644 --- a/python_binding/operator/pybind_MaxPooling.cpp +++ b/python_binding/operator/pybind_MaxPooling.cpp @@ -17,10 +17,10 @@ #include <array> #include "aidge/backend/OperatorImpl.hpp" +#include "aidge/data/Tensor.hpp" #include "aidge/operator/MaxPooling.hpp" #include "aidge/operator/OperatorTensor.hpp" #include "aidge/utils/Types.h" -#include "aidge/data/Tensor.hpp" namespace py = pybind11; namespace Aidge { diff --git a/python_binding/operator/pybind_Mul.cpp b/python_binding/operator/pybind_Mul.cpp index 5354f01ca..47c84c0e5 100644 --- a/python_binding/operator/pybind_Mul.cpp +++ b/python_binding/operator/pybind_Mul.cpp @@ -11,6 +11,7 @@ #include <pybind11/pybind11.h> +#include "aidge/data/Tensor.hpp" #include "aidge/operator/Mul.hpp" #include "aidge/operator/OperatorTensor.hpp" diff --git a/python_binding/operator/pybind_Operator.cpp b/python_binding/operator/pybind_Operator.cpp index 05d6cd089..589bad0be 100644 --- a/python_binding/operator/pybind_Operator.cpp +++ b/python_binding/operator/pybind_Operator.cpp @@ -11,10 +11,12 @@ ********************************************************************************/ #include <pybind11/pybind11.h> +#include <pybind11/stl.h> + #include "aidge/backend/OperatorImpl.hpp" +#include "aidge/data/Tensor.hpp" #include "aidge/operator/Operator.hpp" #include "aidge/utils/Types.h" -#include <pybind11/stl.h> namespace py = pybind11; namespace Aidge { diff --git a/python_binding/operator/pybind_OperatorTensor.cpp b/python_binding/operator/pybind_OperatorTensor.cpp index d0a4d0243..4cd730649 100644 --- a/python_binding/operator/pybind_OperatorTensor.cpp +++ b/python_binding/operator/pybind_OperatorTensor.cpp @@ -10,7 +10,9 @@ ********************************************************************************/ #include <pybind11/pybind11.h> + #include "aidge/backend/OperatorImpl.hpp" +#include "aidge/data/Tensor.hpp" #include "aidge/operator/OperatorTensor.hpp" #include "aidge/operator/Operator.hpp" #include <pybind11/stl.h> diff --git a/python_binding/operator/pybind_Pad.cpp b/python_binding/operator/pybind_Pad.cpp index 27d3a5428..1cd9f074f 100644 --- a/python_binding/operator/pybind_Pad.cpp +++ b/python_binding/operator/pybind_Pad.cpp @@ -9,13 +9,14 @@ * ********************************************************************************/ +#include <array> #include <pybind11/pybind11.h> #include <pybind11/stl.h> #include <string> #include <vector> -#include <array> #include "aidge/backend/OperatorImpl.hpp" +#include "aidge/data/Tensor.hpp" #include "aidge/operator/Pad.hpp" #include "aidge/operator/Operator.hpp" #include "aidge/utils/Types.h" diff --git a/python_binding/operator/pybind_Pop.cpp b/python_binding/operator/pybind_Pop.cpp index 91726fc1d..baae55227 100644 --- a/python_binding/operator/pybind_Pop.cpp +++ b/python_binding/operator/pybind_Pop.cpp @@ -11,6 +11,7 @@ #include <pybind11/pybind11.h> +#include "aidge/data/Tensor.hpp" #include "aidge/operator/Pop.hpp" #include "aidge/operator/OperatorTensor.hpp" diff --git a/python_binding/operator/pybind_Pow.cpp b/python_binding/operator/pybind_Pow.cpp index 03e822adb..9e9ef772c 100644 --- a/python_binding/operator/pybind_Pow.cpp +++ b/python_binding/operator/pybind_Pow.cpp @@ -11,6 +11,7 @@ #include <pybind11/pybind11.h> +#include "aidge/data/Tensor.hpp" #include "aidge/operator/Pow.hpp" #include "aidge/operator/OperatorTensor.hpp" diff --git a/python_binding/operator/pybind_Producer.cpp b/python_binding/operator/pybind_Producer.cpp index 025c8c5dd..eb7451591 100644 --- a/python_binding/operator/pybind_Producer.cpp +++ b/python_binding/operator/pybind_Producer.cpp @@ -12,11 +12,11 @@ #include <pybind11/pybind11.h> #include <pybind11/stl.h> -#include "aidge/utils/Types.h" // #include "aidge/backend/OperatorImpl.hpp" +#include "aidge/data/Tensor.hpp" #include "aidge/operator/OperatorTensor.hpp" #include "aidge/operator/Producer.hpp" -#include "aidge/data/Tensor.hpp" +#include "aidge/utils/Types.h" namespace py = pybind11; namespace Aidge { diff --git a/python_binding/operator/pybind_ReLU.cpp b/python_binding/operator/pybind_ReLU.cpp index f08c67cb9..57601e256 100644 --- a/python_binding/operator/pybind_ReLU.cpp +++ b/python_binding/operator/pybind_ReLU.cpp @@ -11,6 +11,7 @@ #include <pybind11/pybind11.h> +#include "aidge/data/Tensor.hpp" #include "aidge/operator/ReLU.hpp" #include "aidge/operator/OperatorTensor.hpp" diff --git a/python_binding/operator/pybind_ReduceMean.cpp b/python_binding/operator/pybind_ReduceMean.cpp index fbec68640..b89c09d56 100644 --- a/python_binding/operator/pybind_ReduceMean.cpp +++ b/python_binding/operator/pybind_ReduceMean.cpp @@ -9,13 +9,14 @@ * ********************************************************************************/ +#include <array> #include <pybind11/pybind11.h> #include <pybind11/stl.h> #include <string> #include <vector> -#include <array> #include "aidge/backend/OperatorImpl.hpp" +#include "aidge/data/Tensor.hpp" #include "aidge/operator/OperatorTensor.hpp" #include "aidge/operator/ReduceMean.hpp" #include "aidge/utils/Types.h" diff --git a/python_binding/operator/pybind_Reshape.cpp b/python_binding/operator/pybind_Reshape.cpp index dc6a9b4ec..0e336db28 100644 --- a/python_binding/operator/pybind_Reshape.cpp +++ b/python_binding/operator/pybind_Reshape.cpp @@ -11,6 +11,7 @@ #include <pybind11/pybind11.h> +#include "aidge/data/Tensor.hpp" #include "aidge/operator/Reshape.hpp" #include "aidge/operator/OperatorTensor.hpp" diff --git a/python_binding/operator/pybind_Sigmoid.cpp b/python_binding/operator/pybind_Sigmoid.cpp index 2393e56c1..8ffa85815 100644 --- a/python_binding/operator/pybind_Sigmoid.cpp +++ b/python_binding/operator/pybind_Sigmoid.cpp @@ -11,6 +11,7 @@ #include <pybind11/pybind11.h> +#include "aidge/data/Tensor.hpp" #include "aidge/operator/Sigmoid.hpp" #include "aidge/operator/OperatorTensor.hpp" diff --git a/python_binding/operator/pybind_Slice.cpp b/python_binding/operator/pybind_Slice.cpp index 3bb1b082c..558fc98c1 100644 --- a/python_binding/operator/pybind_Slice.cpp +++ b/python_binding/operator/pybind_Slice.cpp @@ -11,6 +11,7 @@ #include <pybind11/pybind11.h> +#include "aidge/data/Tensor.hpp" #include "aidge/operator/Slice.hpp" #include "aidge/operator/OperatorTensor.hpp" diff --git a/python_binding/operator/pybind_Softmax.cpp b/python_binding/operator/pybind_Softmax.cpp index bac553387..837f3ed2b 100644 --- a/python_binding/operator/pybind_Softmax.cpp +++ b/python_binding/operator/pybind_Softmax.cpp @@ -12,6 +12,7 @@ #include <pybind11/pybind11.h> #include <string> +#include "aidge/data/Tensor.hpp" #include "aidge/operator/Softmax.hpp" #include "aidge/operator/OperatorTensor.hpp" diff --git a/python_binding/operator/pybind_Sqrt.cpp b/python_binding/operator/pybind_Sqrt.cpp index 33d46e02c..7065b828e 100644 --- a/python_binding/operator/pybind_Sqrt.cpp +++ b/python_binding/operator/pybind_Sqrt.cpp @@ -11,6 +11,7 @@ #include <pybind11/pybind11.h> +#include "aidge/data/Tensor.hpp" #include "aidge/operator/Sqrt.hpp" #include "aidge/operator/OperatorTensor.hpp" diff --git a/python_binding/operator/pybind_Sub.cpp b/python_binding/operator/pybind_Sub.cpp index 1b858d152..e031040df 100644 --- a/python_binding/operator/pybind_Sub.cpp +++ b/python_binding/operator/pybind_Sub.cpp @@ -11,6 +11,7 @@ #include <pybind11/pybind11.h> +#include "aidge/data/Tensor.hpp" #include "aidge/operator/Sub.hpp" #include "aidge/operator/OperatorTensor.hpp" diff --git a/python_binding/operator/pybind_Tanh.cpp b/python_binding/operator/pybind_Tanh.cpp index 2f3140039..a5c2f9dd5 100644 --- a/python_binding/operator/pybind_Tanh.cpp +++ b/python_binding/operator/pybind_Tanh.cpp @@ -11,6 +11,7 @@ #include <pybind11/pybind11.h> +#include "aidge/data/Tensor.hpp" #include "aidge/operator/Tanh.hpp" #include "aidge/operator/OperatorTensor.hpp" diff --git a/python_binding/operator/pybind_Transpose.cpp b/python_binding/operator/pybind_Transpose.cpp index 59482cf48..f6e2f2225 100644 --- a/python_binding/operator/pybind_Transpose.cpp +++ b/python_binding/operator/pybind_Transpose.cpp @@ -17,10 +17,10 @@ #include <array> #include "aidge/backend/OperatorImpl.hpp" -#include "aidge/operator/Transpose.hpp" +#include "aidge/data/Tensor.hpp" #include "aidge/operator/OperatorTensor.hpp" +#include "aidge/operator/Transpose.hpp" #include "aidge/utils/Types.h" -#include "aidge/data/Tensor.hpp" namespace py = pybind11; namespace Aidge { -- GitLab