From 7f7b5c3a9cc9b361df737425fa80901bc30fdf90 Mon Sep 17 00:00:00 2001 From: NAUD Maxence <maxence.naud@cea.fr> Date: Thu, 28 Mar 2024 14:59:02 +0000 Subject: [PATCH] add graphviewhelper python binding --- include/aidge/recipes/GraphViewHelper.hpp | 2 ++ python_binding/pybind_core.cpp | 2 ++ .../recipes/pybind_GraphViewHelper.cpp | 28 +++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 python_binding/recipes/pybind_GraphViewHelper.cpp diff --git a/include/aidge/recipes/GraphViewHelper.hpp b/include/aidge/recipes/GraphViewHelper.hpp index 45928ee63..a2c571bf4 100644 --- a/include/aidge/recipes/GraphViewHelper.hpp +++ b/include/aidge/recipes/GraphViewHelper.hpp @@ -28,6 +28,8 @@ namespace Aidge { */ std::set<std::shared_ptr<Tensor>> producers(std::shared_ptr<GraphView> graphview); + +// TODO: change for every Tensor of Operator Producer not constant /** * @brief Getter for every ``Tensor`` owned by an ``Operator`` inside the provided ``GraphView``. * @note An ``Operator`` owns its output ``Tensor``s. diff --git a/python_binding/pybind_core.cpp b/python_binding/pybind_core.cpp index 5ffa8f6b4..8f3e5880c 100644 --- a/python_binding/pybind_core.cpp +++ b/python_binding/pybind_core.cpp @@ -68,6 +68,7 @@ void init_GraphRegex(py::module&); void init_MatchSolution(py::module&); void init_Recipes(py::module&); +void init_GraphViewHelper(py::module&); void init_Scheduler(py::module&); void init_TensorUtils(py::module&); @@ -129,6 +130,7 @@ void init_Aidge(py::module& m) { init_MatchSolution(m); init_Recipes(m); + init_GraphViewHelper(m); init_Scheduler(m); init_TensorUtils(m); init_Filler(m); diff --git a/python_binding/recipes/pybind_GraphViewHelper.cpp b/python_binding/recipes/pybind_GraphViewHelper.cpp new file mode 100644 index 000000000..ac56fb4b4 --- /dev/null +++ b/python_binding/recipes/pybind_GraphViewHelper.cpp @@ -0,0 +1,28 @@ +/******************************************************************************** + * Copyright (c) 2023 CEA-List + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + ********************************************************************************/ + +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +#include <memory> +#include <set> + +#include "aidge/graph/GraphView.hpp" +#include "aidge/data/Tensor.hpp" +#include "aidge/recipes/GraphViewHelper.hpp" + +namespace py = pybind11; + +namespace Aidge { +void init_GraphViewHelper(py::module &m) { + m.def("producers", &producers, py::arg("graphview")); +} +} // namespace Aidge -- GitLab