From 152cd114a53b0d79777a1eec76145adb1f375082 Mon Sep 17 00:00:00 2001 From: hrouis <houssemeddine.rouis92@gmail.com> Date: Fri, 15 Dec 2023 15:00:52 +0100 Subject: [PATCH] minor cleanups --- include/aidge/operator/Erf.hpp | 2 +- include/aidge/operator/Gather.hpp | 2 +- include/aidge/operator/ReduceMean.hpp | 2 +- include/aidge/operator/Transpose.hpp | 6 +++++- src/operator/Erf.cpp | 16 ++++++++++++++++ src/operator/Gather.cpp | 5 +++-- src/operator/ReduceMean.cpp | 16 ++++++++++++++++ src/operator/Reshape.cpp | 4 ---- 8 files changed, 43 insertions(+), 10 deletions(-) create mode 100644 src/operator/Erf.cpp create mode 100644 src/operator/ReduceMean.cpp diff --git a/include/aidge/operator/Erf.hpp b/include/aidge/operator/Erf.hpp index a0db65d45..6395756f3 100644 --- a/include/aidge/operator/Erf.hpp +++ b/include/aidge/operator/Erf.hpp @@ -29,7 +29,7 @@ namespace Aidge { class Erf_Op : public OperatorTensor, public Registrable<Erf_Op, std::string, std::unique_ptr<OperatorImpl>(const Erf_Op&)> { public: - static constexpr const char* Type = "Erf"; + static const std::string Type; Erf_Op() : OperatorTensor(Type, 1, 0, 1) {} diff --git a/include/aidge/operator/Gather.hpp b/include/aidge/operator/Gather.hpp index ba7d745fa..f82762228 100644 --- a/include/aidge/operator/Gather.hpp +++ b/include/aidge/operator/Gather.hpp @@ -36,7 +36,7 @@ class Gather_Op : public OperatorTensor, public StaticAttributes<GatherAttr, int> { public: - static constexpr const char* Type = "Gather"; + static const std::string Type; Gather_Op() = delete; diff --git a/include/aidge/operator/ReduceMean.hpp b/include/aidge/operator/ReduceMean.hpp index 8d3ed2f71..f217df0ae 100644 --- a/include/aidge/operator/ReduceMean.hpp +++ b/include/aidge/operator/ReduceMean.hpp @@ -34,7 +34,7 @@ class ReduceMean_Op : public OperatorTensor, public StaticAttributes<ReduceMeanAttr, std::array<int, DIM>, DimSize_t> { public: - static constexpr const char *Type = "ReduceMean"; + static const std::string Type; ReduceMean_Op() = delete; diff --git a/include/aidge/operator/Transpose.hpp b/include/aidge/operator/Transpose.hpp index 8bf5f17ab..f111be76c 100644 --- a/include/aidge/operator/Transpose.hpp +++ b/include/aidge/operator/Transpose.hpp @@ -35,7 +35,7 @@ class Transpose_Op : public OperatorTensor, std::array<DimSize_t, DIM>> { public: - static constexpr const char *Type = "Transpose"; + static const std::string Type; Transpose_Op() = delete; @@ -111,6 +111,10 @@ inline std::shared_ptr<Node> Transpose( static_assert(DIM<=MaxDim,"Too many kernel dimensions required by Transpose, not supported"); return Transpose(to_array(output_dims_order), name); } + +template <DimIdx_t DIM> +const std::string Transpose_Op<DIM>::Type = "Transpose"; + } // namespace Aidge namespace { diff --git a/src/operator/Erf.cpp b/src/operator/Erf.cpp new file mode 100644 index 000000000..387af4edf --- /dev/null +++ b/src/operator/Erf.cpp @@ -0,0 +1,16 @@ +/******************************************************************************** + * 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 <string> + +#include "aidge/operator/Erf.hpp" + +const std::string Aidge::Erf_Op::Type = "Erf"; \ No newline at end of file diff --git a/src/operator/Gather.cpp b/src/operator/Gather.cpp index 26a334bb0..30804994b 100644 --- a/src/operator/Gather.cpp +++ b/src/operator/Gather.cpp @@ -11,14 +11,15 @@ #include <cassert> #include <cstddef> +#include <string> #include <vector> -#include <utility> -#include "aidge/backend/OperatorImpl.hpp" #include "aidge/operator/Gather.hpp" #include "aidge/utils/Types.h" #include "aidge/utils/ErrorHandling.hpp" +const std::string Aidge::Gather_Op::Type = "Gather"; + void Aidge::Gather_Op::computeOutputDims() { // check inputs have been associated if (!getInput(0) || !getInput(1)) { diff --git a/src/operator/ReduceMean.cpp b/src/operator/ReduceMean.cpp new file mode 100644 index 000000000..4460863a6 --- /dev/null +++ b/src/operator/ReduceMean.cpp @@ -0,0 +1,16 @@ +/******************************************************************************** + * 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 <string> + +#include "aidge/operator/ReduceMean.hpp" + +const std::string Aidge::ReduceMean_Op::Type = "ReduceMean"; \ No newline at end of file diff --git a/src/operator/Reshape.cpp b/src/operator/Reshape.cpp index 2464d37a8..b0eea3c1f 100644 --- a/src/operator/Reshape.cpp +++ b/src/operator/Reshape.cpp @@ -9,18 +9,14 @@ * ********************************************************************************/ -#include <cassert> #include <cstddef> #include <string> #include <vector> -#include <utility> -#include "aidge/backend/OperatorImpl.hpp" #include "aidge/operator/Reshape.hpp" #include "aidge/utils/Types.h" #include "aidge/utils/ErrorHandling.hpp" - const std::string Aidge::Reshape_Op::Type = "Reshape"; void Aidge::Reshape_Op::computeOutputDims() { -- GitLab