From be5acaedeeffe28c93003d12fce755dae5d0e3a6 Mon Sep 17 00:00:00 2001 From: Rakotoarivony <lucas.rakotoarivony@thalesgroup.com> Date: Tue, 10 Sep 2024 16:46:05 +0200 Subject: [PATCH] Clean code --- include/aidge/operator/ILayerNorm.hpp | 4 +++- include/aidge/operator/ShiftGELU.hpp | 4 +++- include/aidge/operator/ShiftMax.hpp | 4 +++- src/operator/ILayerNorm.cpp | 11 +++-------- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/aidge/operator/ILayerNorm.hpp b/include/aidge/operator/ILayerNorm.hpp index 97f9ce33e..9eec04592 100644 --- a/include/aidge/operator/ILayerNorm.hpp +++ b/include/aidge/operator/ILayerNorm.hpp @@ -1,11 +1,13 @@ /******************************************************************************** - * Copyright (c) 2023 CEA-List + * Copyright (c) 2024 Thales * * 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 + * Author: Lucas RAKOTOARIVONY, Thales Research & Technology France + * Date: 10.09.2024 * ********************************************************************************/ diff --git a/include/aidge/operator/ShiftGELU.hpp b/include/aidge/operator/ShiftGELU.hpp index 41fcedf96..e85ecfd50 100644 --- a/include/aidge/operator/ShiftGELU.hpp +++ b/include/aidge/operator/ShiftGELU.hpp @@ -1,11 +1,13 @@ /******************************************************************************** - * Copyright (c) 2023 CEA-List + * Copyright (c) 2024 Thales * * 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 + * Author: Lucas RAKOTOARIVONY, Thales Research & Technology France + * Date: 10.09.2024 * ********************************************************************************/ diff --git a/include/aidge/operator/ShiftMax.hpp b/include/aidge/operator/ShiftMax.hpp index 876984407..7a68f4799 100644 --- a/include/aidge/operator/ShiftMax.hpp +++ b/include/aidge/operator/ShiftMax.hpp @@ -1,11 +1,13 @@ /******************************************************************************** - * Copyright (c) 2023 CEA-List + * Copyright (c) 2024 Thales * * 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 + * Author: Lucas RAKOTOARIVONY, Thales Research & Technology France + * Date: 10.09.2024 * ********************************************************************************/ diff --git a/src/operator/ILayerNorm.cpp b/src/operator/ILayerNorm.cpp index 7c266135c..dafe7ed0f 100644 --- a/src/operator/ILayerNorm.cpp +++ b/src/operator/ILayerNorm.cpp @@ -1,11 +1,13 @@ /******************************************************************************** - * Copyright (c) 2023 CEA-List + * Copyright (c) 2024 Thales * * 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 + * Author: Lucas RAKOTOARIVONY, Thales Research & Technology France + * Date: 10.09.2024 * ********************************************************************************/ @@ -22,11 +24,6 @@ const std::string Aidge::ILayerNorm_Op::Type = "ILayerNorm"; void Aidge::ILayerNorm_Op::associateInput(const Aidge::IOIndex_t inputIdx, const std::shared_ptr<Aidge::Data>& data) { AIDGE_ASSERT(inputIdx < 3, "Operators {} supports only {} inputs", type(), nbInputs()); AIDGE_ASSERT(data->type() == Tensor::Type, "input data must be of Tensor type"); - // TODO: FIXME: check this, because data dims may not be initialized at this point... - //if (inputIdx == 2) { - // assert(std::dynamic_pointer_cast<Tensor>(data)->size() == ((this->template getAttr<FCAttr::NoBias>()) == false ? static_cast<std::size_t>(this->template getAttr<FCAttr::OutChannels>()) : 0)); - // assert(std::dynamic_pointer_cast<Tensor>(data)->nbDims() == 1); - //} mInputs[inputIdx] = std::dynamic_pointer_cast<Tensor>(data); if (inputIdx == 0 && getInput(0)->nbDims() == 1) mInputs[inputIdx]->resize({1, getInput(inputIdx)->size()}); @@ -37,8 +34,6 @@ bool Aidge::ILayerNorm_Op::forwardDims(bool /*allowDataDependency*/) { const DimSize_t nbFeatures = getInput(0)->dims()[1]; for (std::size_t i = 0; i < nbInputs(); ++i) { if(inputCategory(i) == InputCategory::Param && getInput(i)->size() != nbFeatures) { - // /!\ Input size should be handled BEFORE calling this function - // This should raise an error getInput(i)->resize({getInput(0)->dims()[1]}); } } -- GitLab