Skip to content
Snippets Groups Projects
Commit 77ff41cb authored by Benjamin Halimi's avatar Benjamin Halimi
Browse files

minor changes

parent 9f67e1bc
No related branches found
No related tags found
1 merge request!15version 0.2.0
......@@ -9,17 +9,6 @@
*
********************************************************************************/
/********************************************************************************
* 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 "aidge/quantization/QAT/QAT_FixedQ.hpp"
#include "aidge/operator/FixedQ.hpp"
......@@ -29,17 +18,6 @@
#include "aidge/scheduler/Scheduler.hpp"
#include "aidge/graph/Matching.hpp"
/*
#include "aidge/graph/Node.hpp"
#include "aidge/utils/Log.hpp"
#include "aidge/operator/Producer.hpp"
#include "aidge/operator/Mul.hpp"
#include "aidge/operator/ReLU.hpp"
#include "aidge/operator/Scaling.hpp"
#include "aidge/recipes/Recipes.hpp"
*/
namespace Aidge {
void QuantFixedQ::insertActQuantizers(std::shared_ptr<GraphView> graphView, size_t nbBits, float span)
......@@ -54,7 +32,7 @@ void QuantFixedQ::insertActQuantizers(std::shared_ptr<GraphView> graphView, size
const auto success = GraphView::replace({reluNode}, {fixedqNode});
if (!success) {
Log::warn("Could not replace ReLU operator with LSQ quantizer");
Log::warn("Could not replace ReLU operator with FixedQ quantizer");
}
}
}
......@@ -65,7 +43,7 @@ void QuantFixedQ::insertParamQuantizers(std::shared_ptr<GraphView> graphView, si
for (const auto& match : matches) {
auto linearNode = match.graph->rootNode();
auto fixedqNode = FixedQ(nbBits, span, false); // XXX default value, this one should stay !!!
auto fixedqNode = FixedQ(nbBits, span, false); // XXX default sign, this one should stay !!!
graphView->insertParent(linearNode, fixedqNode, 1, 0, 0);
}
}
......@@ -94,10 +72,8 @@ void QuantFixedQ::adjustParamQuantizersSpans(std::shared_ptr<GraphView> graphVie
{
auto quantizer = match.graph->rootNode()->getChildren(0)[0];
const auto op = std::static_pointer_cast<FixedQ_Op>(quantizer->getOperator());
auto weightTensor = op->getInput(0);
float weightStd = getTensorStd(weightTensor);
float weightStd = getTensorStd(op->getInput(0));
op->span() = weightStd * scale;
}
}
......
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