From 990a13820f2bf61df8c8b2af54c21b62a670afeb Mon Sep 17 00:00:00 2001 From: cmoineau <cyril.moineau@cea.fr> Date: Mon, 6 May 2024 13:30:17 +0000 Subject: [PATCH] Rename initGradient -> initGrad for name consistency. --- include/aidge/data/Tensor.hpp | 2 +- python_binding/data/pybind_Tensor.cpp | 4 ++-- src/recipes/GraphViewHelper.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/aidge/data/Tensor.hpp b/include/aidge/data/Tensor.hpp index ee4d9cdcb..3dbf54a5f 100644 --- a/include/aidge/data/Tensor.hpp +++ b/include/aidge/data/Tensor.hpp @@ -569,7 +569,7 @@ public: * @note If Tensor instance and implementation already existed for the gradient * nothing is done. */ - void initGradient() { + void initGrad() { if (!mGrad) { mGrad = std::make_shared<Tensor>(mDims); } diff --git a/python_binding/data/pybind_Tensor.cpp b/python_binding/data/pybind_Tensor.cpp index a21aa8be5..1e4974c1c 100644 --- a/python_binding/data/pybind_Tensor.cpp +++ b/python_binding/data/pybind_Tensor.cpp @@ -1,4 +1,4 @@ -/******************************************************************************** +./******************************************************************************** * Copyright (c) 2023 CEA-List * * This program and the accompanying materials are made available under the @@ -79,7 +79,7 @@ void init_Tensor(py::module& m){ .def("grad", &Tensor::grad) .def("set_grad", &Tensor::setGrad) .def("dtype", &Tensor::dataType) - .def("init_gradient", &Tensor::initGradient) + .def("init_grad", &Tensor::initGrad) .def("size", &Tensor::size) .def("resize", (void (Tensor::*)(const std::vector<DimSize_t>&, std::vector<DimSize_t>)) &Tensor::resize) .def("has_impl", &Tensor::hasImpl) diff --git a/src/recipes/GraphViewHelper.cpp b/src/recipes/GraphViewHelper.cpp index 3b42db7fe..b0c99bffb 100644 --- a/src/recipes/GraphViewHelper.cpp +++ b/src/recipes/GraphViewHelper.cpp @@ -51,7 +51,7 @@ void Aidge::compile_gradient(std::shared_ptr<Aidge::GraphView> gv) { AIDGE_ASSERT(node->getOperator()->operatorType() == OperatorType::Tensor, "Cannot instanciate gradient of an Operator ({}) that doesn't use Tensor.", node->getOperator()->type()); const std::shared_ptr<OperatorTensor> op = std::dynamic_pointer_cast<OperatorTensor>(node -> getOperator()); for (std::size_t o = 0; o < node -> nbOutputs(); ++o) { - op->getOutput(o)->initGradient(); + op->getOutput(o)->initGrad(); } } -} \ No newline at end of file +} -- GitLab