Skip to content
Snippets Groups Projects
Commit 19057dd9 authored by Maxence Naud's avatar Maxence Naud
Browse files

Merge branch 'BuildFix' into 'main'

Build fix

Closes aidge#14

See merge request !31
parents 026123ea 08651303
No related branches found
No related tags found
1 merge request!31Build fix
Pipeline #32958 passed
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "aidge/operator/MetaOperator.hpp" #include "aidge/operator/MetaOperator.hpp"
#include "aidge/operator/MetaOperatorDefs.hpp" #include "aidge/operator/MetaOperatorDefs.hpp"
#include "aidge/operator/Operator.hpp" #include "aidge/operator/Operator.hpp"
#include "aidge/operator/Pad.hpp"
#include "aidge/operator/Producer.hpp" #include "aidge/operator/Producer.hpp"
#include "aidge/operator/ReLU.hpp" #include "aidge/operator/ReLU.hpp"
#include "aidge/operator/Softmax.hpp" #include "aidge/operator/Softmax.hpp"
......
#include "aidge/graphRegex/matchFsm/FsmGraph.hpp" #include "aidge/graphRegex/matchFsm/FsmGraph.hpp"
using namespace Aidge; using namespace Aidge;
...@@ -14,7 +14,7 @@ FsmGraph::FsmGraph(/* args */){ ...@@ -14,7 +14,7 @@ FsmGraph::FsmGraph(/* args */){
if(startNodes.size() != startNodesFsm.size()){ if(startNodes.size() != startNodesFsm.size()){
throw std::runtime_error("bad number of Start nodes"); throw std::runtime_error("bad number of Start nodes");
} }
std::vector<std::shared_ptr<FsmRunTimeContext>> walks; std::vector<std::shared_ptr<FsmRunTimeContext>> walks;
for(std::size_t i = 0; i < startNodes.size(); i++){ for(std::size_t i = 0; i < startNodes.size(); i++){
walks.push_back(std::make_shared<FsmRunTimeContext>(startNodesFsm[i],startNodes[i])); walks.push_back(std::make_shared<FsmRunTimeContext>(startNodesFsm[i],startNodes[i]));
...@@ -32,16 +32,16 @@ FsmGraph::FsmGraph(/* args */){ ...@@ -32,16 +32,16 @@ FsmGraph::FsmGraph(/* args */){
for(auto fsmContext : walks){ for(auto fsmContext : walks){
allContextSee.push_back(fsmContext); allContextSee.push_back(fsmContext);
//if we are in a valid st we save it //if we are in a valid st we save it
//it's one solution of the posible solution of the matching //it's one solution of the posible solution of the matching
if(fsmContext->isOnValidState()){ if(fsmContext->isOnValidState()){
//not save 2 time the same end point //not save 2 time the same end point
if(!std::any_of(allValidContext.begin(), allValidContext.end(), if(!std::any_of(allValidContext.begin(), allValidContext.end(),
[&](std::shared_ptr<Aidge::FsmRunTimeContext> oldValid) { [&](std::shared_ptr<Aidge::FsmRunTimeContext> oldValid) {
return fsmContext->areEqual(oldValid); return fsmContext->areEqual(oldValid);
})){ })){
allValidContext.push_back(fsmContext); allValidContext.push_back(fsmContext);
} }
} }
//dont test 2 time a fsmContext //dont test 2 time a fsmContext
...@@ -60,15 +60,15 @@ FsmGraph::FsmGraph(/* args */){ ...@@ -60,15 +60,15 @@ FsmGraph::FsmGraph(/* args */){
walks.swap(nextWalks); walks.swap(nextWalks);
nextWalks.clear(); nextWalks.clear();
} }
return std::make_shared<MatchResult>(allValidContext,getNbSubFsm()); return std::make_shared<MatchResult>(allValidContext,getNbSubFsm());
} }
/////////////// ///////////////
// FSM construction // FSM construction
/////////////// ///////////////
const std::set<std::shared_ptr<FsmEdge>>& FsmGraph::getEdge(void){ const std::set<std::shared_ptr<FsmEdge>>& FsmGraph::getEdge(void){
return mEdges; return mEdges;
...@@ -140,7 +140,7 @@ void FsmGraph::mergeOneStartOneValid(const std::shared_ptr<FsmGraph> fsmGraph){ ...@@ -140,7 +140,7 @@ void FsmGraph::mergeOneStartOneValid(const std::shared_ptr<FsmGraph> fsmGraph){
} }
unionG(fsmGraph); unionG(fsmGraph);
//for loop useless but for future merge it's coudl be used //for loop useless but for future merge it's coudl be used
for(auto valid : validNodes){ for(auto valid : validNodes){
valid->unValid(); valid->unValid();
for(auto start : startNodes){ for(auto start : startNodes){
...@@ -159,9 +159,11 @@ void FsmGraph::incOrigineAllNodeBy(std::size_t incr){ ...@@ -159,9 +159,11 @@ void FsmGraph::incOrigineAllNodeBy(std::size_t incr){
for(auto node :nodes){ for(auto node :nodes){
node->incOrigine(incr); node->incOrigine(incr);
} }
std::set<std::size_t> updatedOrigin;
for(auto origin : mAllOrigine){ for(auto origin : mAllOrigine){
origin += incr; updatedOrigin.insert(origin + incr);
} }
mAllOrigine.swap(updatedOrigin);
} }
void FsmGraph::_mergeNode(std::shared_ptr<FsmNode> source,std::shared_ptr<FsmNode> dest){ void FsmGraph::_mergeNode(std::shared_ptr<FsmNode> source,std::shared_ptr<FsmNode> dest){
...@@ -189,7 +191,7 @@ void FsmGraph::_mergeNode(std::shared_ptr<FsmNode> source,std::shared_ptr<FsmNod ...@@ -189,7 +191,7 @@ void FsmGraph::_mergeNode(std::shared_ptr<FsmNode> source,std::shared_ptr<FsmNod
} }
} }
//check is source is not in graph //check is source is not in graph
nodes = getNodes(); nodes = getNodes();
if(nodes.find(source) != nodes.end() ){ if(nodes.find(source) != nodes.end() ){
throw std::runtime_error("FsmGraph merge node not effective"); throw std::runtime_error("FsmGraph merge node not effective");
......
#include "aidge/nodeTester/ConditionalInterpreter.hpp" #include "aidge/nodeTester/ConditionalInterpreter.hpp"
using namespace Aidge; using namespace Aidge;
/////////////////////////////// ///////////////////////////////
...@@ -31,7 +31,7 @@ using namespace Aidge; ...@@ -31,7 +31,7 @@ using namespace Aidge;
mLambdaRegiter.insert("getType",+[](NodePtr NodeOp){return NodeOp->type();}); mLambdaRegiter.insert("getType",+[](NodePtr NodeOp){return NodeOp->type();});
} }
bool ConditionalInterpreter::test( const NodePtr nodeOp) bool ConditionalInterpreter::test( const NodePtr nodeOp)
{ {
...@@ -39,9 +39,9 @@ using namespace Aidge; ...@@ -39,9 +39,9 @@ using namespace Aidge;
clearRes(); clearRes();
try{ try{
std::vector<ConditionalData*> r = visit({mTree},nodeOp); std::vector<ConditionalData*> r = visit({mTree},nodeOp);
if (mResolution.size() != 1){ if (mResolution.size() != 1){
throw std::runtime_error("Multy output interpretation output"); throw std::runtime_error("Multi-output interpretation output");
}else{ }else{
if (!mResolution[0]->isTypeEqualTo<bool>()){ if (!mResolution[0]->isTypeEqualTo<bool>()){
throw std::runtime_error("TEST OUT MUST BE A BOOL "); throw std::runtime_error("TEST OUT MUST BE A BOOL ");
...@@ -53,7 +53,7 @@ using namespace Aidge; ...@@ -53,7 +53,7 @@ using namespace Aidge;
}catch(const std::exception& e){ }catch(const std::exception& e){
std::ostringstream errorMessage; std::ostringstream errorMessage;
errorMessage << "Error in test " << "\n\t" << e.what() << "\n"; errorMessage << "Error in test " << "\n\t" << e.what() << "\n";
throw std::runtime_error(errorMessage.str()); throw std::runtime_error(errorMessage.str());
} }
} }
...@@ -70,7 +70,7 @@ using namespace Aidge; ...@@ -70,7 +70,7 @@ using namespace Aidge;
switch (node->getType()){ switch (node->getType()){
/////////////////////////////////// ///////////////////////////////////
//OPERATOR //OPERATOR
/////////////////////////////////// ///////////////////////////////////
case ConditionalTokenTypes::NOT: case ConditionalTokenTypes::NOT:
{ {
visit(node->getChilds(),nodeOp); visit(node->getChilds(),nodeOp);
...@@ -105,10 +105,10 @@ using namespace Aidge; ...@@ -105,10 +105,10 @@ using namespace Aidge;
/////////////////////////////////// ///////////////////////////////////
//VALUE //VALUE
/////////////////////////////////// ///////////////////////////////////
case ConditionalTokenTypes::KEY: case ConditionalTokenTypes::KEY:
break; break;
case ConditionalTokenTypes::INTEGER: case ConditionalTokenTypes::INTEGER:
{ {
...@@ -118,7 +118,7 @@ using namespace Aidge; ...@@ -118,7 +118,7 @@ using namespace Aidge;
case ConditionalTokenTypes::FLOAT: case ConditionalTokenTypes::FLOAT:
{ {
fStrToFloat(node); fStrToFloat(node);
} }
break; break;
case ConditionalTokenTypes::STRING: case ConditionalTokenTypes::STRING:
...@@ -126,7 +126,7 @@ using namespace Aidge; ...@@ -126,7 +126,7 @@ using namespace Aidge;
fStrToStr(node); fStrToStr(node);
} }
break; break;
case ConditionalTokenTypes::NODE: //TODO case ConditionalTokenTypes::NODE: //TODO
{ {
...@@ -141,14 +141,14 @@ using namespace Aidge; ...@@ -141,14 +141,14 @@ using namespace Aidge;
{ {
visit(node->getChilds(),nodeOp); visit(node->getChilds(),nodeOp);
fLambda(node); fLambda(node);
} }
break; break;
case ConditionalTokenTypes::BOOL: //TODO case ConditionalTokenTypes::BOOL: //TODO
{ {
ConditionalData* data = new ConditionalData; ConditionalData* data = new ConditionalData;
if(node->getValue() == "true"){ if(node->getValue() == "true"){
data->setValue<bool>(true); data->setValue<bool>(true);
}else{ }else{
...@@ -170,7 +170,7 @@ using namespace Aidge; ...@@ -170,7 +170,7 @@ using namespace Aidge;
}catch(const std::exception& e){ }catch(const std::exception& e){
std::ostringstream errorMessage; std::ostringstream errorMessage;
errorMessage << "Error in visiting AST for node"<< nodeOp->name() << "\n\t" << e.what() << "\n"; errorMessage << "Error in visiting AST for node"<< nodeOp->name() << "\n\t" << e.what() << "\n";
throw std::runtime_error(errorMessage.str()); throw std::runtime_error(errorMessage.str());
} }
} }
...@@ -192,7 +192,7 @@ using namespace Aidge; ...@@ -192,7 +192,7 @@ using namespace Aidge;
void ConditionalInterpreter::fStrToFloat(const std::shared_ptr<AstNode<ConditionalTokenTypes>>& node) void ConditionalInterpreter::fStrToFloat(const std::shared_ptr<AstNode<ConditionalTokenTypes>>& node)
{ {
ConditionalData* data = new ConditionalData; ConditionalData* data = new ConditionalData;
data->setValue<float>(std::stof(node->getValue())); data->setValue<float>(std::stof(node->getValue()));
mResolution.push_back(data); mResolution.push_back(data);
...@@ -205,7 +205,7 @@ using namespace Aidge; ...@@ -205,7 +205,7 @@ using namespace Aidge;
mResolution.push_back(data); mResolution.push_back(data);
} }
void ConditionalInterpreter::fLambda(const std::shared_ptr<AstNode<ConditionalTokenTypes>>& node) void ConditionalInterpreter::fLambda(const std::shared_ptr<AstNode<ConditionalTokenTypes>>& node)
{ {
//if the lambda have input //if the lambda have input
ConditionalData* data; ConditionalData* data;
...@@ -214,7 +214,7 @@ using namespace Aidge; ...@@ -214,7 +214,7 @@ using namespace Aidge;
} catch (const std::exception& e) { } catch (const std::exception& e) {
std::ostringstream errorMessage; std::ostringstream errorMessage;
errorMessage << "Error in conditional interpretation when run the "<< node->getValue() <<" Lambda\n\t" << e.what() << "\n"; errorMessage << "Error in conditional interpretation when run the "<< node->getValue() <<" Lambda\n\t" << e.what() << "\n";
throw std::runtime_error(errorMessage.str()); throw std::runtime_error(errorMessage.str());
} }
clearRes(); clearRes();
...@@ -224,7 +224,7 @@ using namespace Aidge; ...@@ -224,7 +224,7 @@ using namespace Aidge;
void ConditionalInterpreter::fEq(void) void ConditionalInterpreter::fEq(void)
{ {
if (mResolution.size() != 2){ if (mResolution.size() != 2){
throw std::runtime_error("EQ need 2 arg and get :" + mResolution.size()); throw std::runtime_error("EQ need 2 arg and get :" + std::to_string(mResolution.size()));
} }
auto a = mResolution[0]; auto a = mResolution[0];
auto b = mResolution[1]; auto b = mResolution[1];
...@@ -256,7 +256,7 @@ using namespace Aidge; ...@@ -256,7 +256,7 @@ using namespace Aidge;
void ConditionalInterpreter::fNeq(void) void ConditionalInterpreter::fNeq(void)
{ {
if (mResolution.size() != 2){ if (mResolution.size() != 2){
throw std::runtime_error("NEQ need 2 arg and get :" + mResolution.size()); throw std::runtime_error("NEQ need 2 arg and get :" + std::to_string(mResolution.size()));
} }
auto a = mResolution[0]; auto a = mResolution[0];
auto b = mResolution[1]; auto b = mResolution[1];
...@@ -285,7 +285,7 @@ using namespace Aidge; ...@@ -285,7 +285,7 @@ using namespace Aidge;
void ConditionalInterpreter::fAnd(void) void ConditionalInterpreter::fAnd(void)
{ {
if (mResolution.size() != 2){ if (mResolution.size() != 2){
throw std::runtime_error("AND need 2 arg and get :" + mResolution.size()); throw std::runtime_error("AND need 2 arg and get :" + std::to_string(mResolution.size()));
} }
auto a = mResolution[0]; auto a = mResolution[0];
auto b = mResolution[1]; auto b = mResolution[1];
...@@ -297,7 +297,7 @@ using namespace Aidge; ...@@ -297,7 +297,7 @@ using namespace Aidge;
ConditionalData* data = new ConditionalData; ConditionalData* data = new ConditionalData;
data->setValue<bool>( a->getValue<bool>() && b->getValue<bool>()); data->setValue<bool>( a->getValue<bool>() && b->getValue<bool>());
clearRes(); clearRes();
mResolution.push_back(data); mResolution.push_back(data);
...@@ -306,7 +306,7 @@ using namespace Aidge; ...@@ -306,7 +306,7 @@ using namespace Aidge;
void ConditionalInterpreter::fOr(void) void ConditionalInterpreter::fOr(void)
{ {
if (mResolution.size() != 2){ if (mResolution.size() != 2){
throw std::runtime_error("OR need 2 arg and get :" + mResolution.size()); throw std::runtime_error("OR need 2 arg and get :" + std::to_string(mResolution.size()));
} }
auto a = mResolution[0]; auto a = mResolution[0];
auto b = mResolution[1]; auto b = mResolution[1];
...@@ -318,7 +318,7 @@ using namespace Aidge; ...@@ -318,7 +318,7 @@ using namespace Aidge;
ConditionalData* data = new ConditionalData; ConditionalData* data = new ConditionalData;
data->setValue<bool>( a->getValue<bool>() || b->getValue<bool>()); data->setValue<bool>( a->getValue<bool>() || b->getValue<bool>());
clearRes(); clearRes();
mResolution.push_back(data); mResolution.push_back(data);
...@@ -327,7 +327,7 @@ using namespace Aidge; ...@@ -327,7 +327,7 @@ using namespace Aidge;
void ConditionalInterpreter::fNot() void ConditionalInterpreter::fNot()
{ {
if (mResolution.size() != 1){ if (mResolution.size() != 1){
throw std::runtime_error("not need 1 arg and get :" + mResolution.size()); throw std::runtime_error("NOT need 1 arg and get :" + std::to_string(mResolution.size()));
} }
auto a = mResolution[0]; auto a = mResolution[0];
...@@ -337,7 +337,7 @@ using namespace Aidge; ...@@ -337,7 +337,7 @@ using namespace Aidge;
ConditionalData* data = new ConditionalData; ConditionalData* data = new ConditionalData;
data->setValue<bool>( !a->getValue<bool>() ); data->setValue<bool>( !a->getValue<bool>() );
clearRes(); clearRes();
mResolution.push_back(data); mResolution.push_back(data);
......
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