Skip to content
Snippets Groups Projects
Commit be5acaed authored by Lucas RAKOTOARIVONY's avatar Lucas RAKOTOARIVONY
Browse files

Clean code

parent 336e9e95
No related branches found
No related tags found
1 merge request!196I-ViT Integration
Pipeline #54305 passed
/******************************************************************************** /********************************************************************************
* Copyright (c) 2023 CEA-List * Copyright (c) 2024 Thales
* *
* This program and the accompanying materials are made available under the * This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at * terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0. * http://www.eclipse.org/legal/epl-2.0.
* *
* SPDX-License-Identifier: EPL-2.0 * SPDX-License-Identifier: EPL-2.0
* Author: Lucas RAKOTOARIVONY, Thales Research & Technology France
* Date: 10.09.2024
* *
********************************************************************************/ ********************************************************************************/
......
/******************************************************************************** /********************************************************************************
* Copyright (c) 2023 CEA-List * Copyright (c) 2024 Thales
* *
* This program and the accompanying materials are made available under the * This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at * terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0. * http://www.eclipse.org/legal/epl-2.0.
* *
* SPDX-License-Identifier: EPL-2.0 * SPDX-License-Identifier: EPL-2.0
* Author: Lucas RAKOTOARIVONY, Thales Research & Technology France
* Date: 10.09.2024
* *
********************************************************************************/ ********************************************************************************/
......
/******************************************************************************** /********************************************************************************
* Copyright (c) 2023 CEA-List * Copyright (c) 2024 Thales
* *
* This program and the accompanying materials are made available under the * This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at * terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0. * http://www.eclipse.org/legal/epl-2.0.
* *
* SPDX-License-Identifier: EPL-2.0 * SPDX-License-Identifier: EPL-2.0
* Author: Lucas RAKOTOARIVONY, Thales Research & Technology France
* Date: 10.09.2024
* *
********************************************************************************/ ********************************************************************************/
......
/******************************************************************************** /********************************************************************************
* Copyright (c) 2023 CEA-List * Copyright (c) 2024 Thales
* *
* This program and the accompanying materials are made available under the * This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at * terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0. * http://www.eclipse.org/legal/epl-2.0.
* *
* SPDX-License-Identifier: 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"; ...@@ -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) { 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(inputIdx < 3, "Operators {} supports only {} inputs", type(), nbInputs());
AIDGE_ASSERT(data->type() == Tensor::Type, "input data must be of Tensor type"); 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); mInputs[inputIdx] = std::dynamic_pointer_cast<Tensor>(data);
if (inputIdx == 0 && getInput(0)->nbDims() == 1) if (inputIdx == 0 && getInput(0)->nbDims() == 1)
mInputs[inputIdx]->resize({1, getInput(inputIdx)->size()}); mInputs[inputIdx]->resize({1, getInput(inputIdx)->size()});
...@@ -37,8 +34,6 @@ bool Aidge::ILayerNorm_Op::forwardDims(bool /*allowDataDependency*/) { ...@@ -37,8 +34,6 @@ bool Aidge::ILayerNorm_Op::forwardDims(bool /*allowDataDependency*/) {
const DimSize_t nbFeatures = getInput(0)->dims()[1]; const DimSize_t nbFeatures = getInput(0)->dims()[1];
for (std::size_t i = 0; i < nbInputs(); ++i) { for (std::size_t i = 0; i < nbInputs(); ++i) {
if(inputCategory(i) == InputCategory::Param && getInput(i)->size() != nbFeatures) { 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]}); getInput(i)->resize({getInput(0)->dims()[1]});
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment