Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aidge_core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eclipse Projects
aidge
aidge_core
Commits
19057dd9
Commit
19057dd9
authored
1 year ago
by
Maxence Naud
Browse files
Options
Downloads
Plain Diff
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
!31
Build fix
Pipeline
#32958
passed
1 year ago
Stage: static_analysis
Stage: build
Stage: test
Stage: coverage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/aidge/aidge.hpp
+1
-0
1 addition, 0 deletions
include/aidge/aidge.hpp
src/graphRegex/matchFsm/FsmGraph.cpp
+13
-11
13 additions, 11 deletions
src/graphRegex/matchFsm/FsmGraph.cpp
src/nodeTester/ConditionalInterpreter.cpp
+25
-25
25 additions, 25 deletions
src/nodeTester/ConditionalInterpreter.cpp
with
39 additions
and
36 deletions
include/aidge/aidge.hpp
+
1
−
0
View file @
19057dd9
...
...
@@ -38,6 +38,7 @@
#include
"aidge/operator/MetaOperator.hpp"
#include
"aidge/operator/MetaOperatorDefs.hpp"
#include
"aidge/operator/Operator.hpp"
#include
"aidge/operator/Pad.hpp"
#include
"aidge/operator/Producer.hpp"
#include
"aidge/operator/ReLU.hpp"
#include
"aidge/operator/Softmax.hpp"
...
...
This diff is collapsed.
Click to expand it.
src/graphRegex/matchFsm/FsmGraph.cpp
+
13
−
11
View file @
19057dd9
#include
"aidge/graphRegex/matchFsm/FsmGraph.hpp"
using
namespace
Aidge
;
using
namespace
Aidge
;
...
...
@@ -14,7 +14,7 @@ FsmGraph::FsmGraph(/* args */){
if
(
startNodes
.
size
()
!=
startNodesFsm
.
size
()){
throw
std
::
runtime_error
(
"bad number of Start nodes"
);
}
std
::
vector
<
std
::
shared_ptr
<
FsmRunTimeContext
>>
walks
;
for
(
std
::
size_t
i
=
0
;
i
<
startNodes
.
size
();
i
++
){
walks
.
push_back
(
std
::
make_shared
<
FsmRunTimeContext
>
(
startNodesFsm
[
i
],
startNodes
[
i
]));
...
...
@@ -32,16 +32,16 @@ FsmGraph::FsmGraph(/* args */){
for
(
auto
fsmContext
:
walks
){
allContextSee
.
push_back
(
fsmContext
);
//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
()){
//not save 2 time the same end point
//not save 2 time the same end point
if
(
!
std
::
any_of
(
allValidContext
.
begin
(),
allValidContext
.
end
(),
[
&
](
std
::
shared_ptr
<
Aidge
::
FsmRunTimeContext
>
oldValid
)
{
return
fsmContext
->
areEqual
(
oldValid
);
})){
allValidContext
.
push_back
(
fsmContext
);
}
}
//dont test 2 time a fsmContext
...
...
@@ -60,15 +60,15 @@ FsmGraph::FsmGraph(/* args */){
walks
.
swap
(
nextWalks
);
nextWalks
.
clear
();
}
return
std
::
make_shared
<
MatchResult
>
(
allValidContext
,
getNbSubFsm
());
}
///////////////
// FSM construction
// FSM construction
///////////////
const
std
::
set
<
std
::
shared_ptr
<
FsmEdge
>>&
FsmGraph
::
getEdge
(
void
){
return
mEdges
;
...
...
@@ -140,7 +140,7 @@ void FsmGraph::mergeOneStartOneValid(const std::shared_ptr<FsmGraph> 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
){
valid
->
unValid
();
for
(
auto
start
:
startNodes
){
...
...
@@ -159,9 +159,11 @@ void FsmGraph::incOrigineAllNodeBy(std::size_t incr){
for
(
auto
node
:
nodes
){
node
->
incOrigine
(
incr
);
}
std
::
set
<
std
::
size_t
>
updatedOrigin
;
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
){
...
...
@@ -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
();
if
(
nodes
.
find
(
source
)
!=
nodes
.
end
()
){
throw
std
::
runtime_error
(
"FsmGraph merge node not effective"
);
...
...
This diff is collapsed.
Click to expand it.
src/nodeTester/ConditionalInterpreter.cpp
+
25
−
25
View file @
19057dd9
#include
"aidge/nodeTester/ConditionalInterpreter.hpp"
using
namespace
Aidge
;
using
namespace
Aidge
;
///////////////////////////////
...
...
@@ -31,7 +31,7 @@ using namespace Aidge;
mLambdaRegiter
.
insert
(
"getType"
,
+
[](
NodePtr
NodeOp
){
return
NodeOp
->
type
();});
}
bool
ConditionalInterpreter
::
test
(
const
NodePtr
nodeOp
)
{
...
...
@@ -39,9 +39,9 @@ using namespace Aidge;
clearRes
();
try
{
std
::
vector
<
ConditionalData
*>
r
=
visit
({
mTree
},
nodeOp
);
if
(
mResolution
.
size
()
!=
1
){
throw
std
::
runtime_error
(
"Mult
y
output interpretation output"
);
throw
std
::
runtime_error
(
"Mult
i-
output interpretation output"
);
}
else
{
if
(
!
mResolution
[
0
]
->
isTypeEqualTo
<
bool
>
()){
throw
std
::
runtime_error
(
"TEST OUT MUST BE A BOOL "
);
...
...
@@ -53,7 +53,7 @@ using namespace Aidge;
}
catch
(
const
std
::
exception
&
e
){
std
::
ostringstream
errorMessage
;
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;
switch
(
node
->
getType
()){
///////////////////////////////////
//OPERATOR
///////////////////////////////////
///////////////////////////////////
case
ConditionalTokenTypes
::
NOT
:
{
visit
(
node
->
getChilds
(),
nodeOp
);
...
...
@@ -105,10 +105,10 @@ using namespace Aidge;
///////////////////////////////////
//VALUE
///////////////////////////////////
///////////////////////////////////
case
ConditionalTokenTypes
::
KEY
:
break
;
case
ConditionalTokenTypes
::
INTEGER
:
{
...
...
@@ -118,7 +118,7 @@ using namespace Aidge;
case
ConditionalTokenTypes
::
FLOAT
:
{
fStrToFloat
(
node
);
}
break
;
case
ConditionalTokenTypes
::
STRING
:
...
...
@@ -126,7 +126,7 @@ using namespace Aidge;
fStrToStr
(
node
);
}
break
;
case
ConditionalTokenTypes
::
NODE
:
//TODO
{
...
...
@@ -141,14 +141,14 @@ using namespace Aidge;
{
visit
(
node
->
getChilds
(),
nodeOp
);
fLambda
(
node
);
}
break
;
case
ConditionalTokenTypes
::
BOOL
:
//TODO
{
ConditionalData
*
data
=
new
ConditionalData
;
if
(
node
->
getValue
()
==
"true"
){
data
->
setValue
<
bool
>
(
true
);
}
else
{
...
...
@@ -170,7 +170,7 @@ using namespace Aidge;
}
catch
(
const
std
::
exception
&
e
){
std
::
ostringstream
errorMessage
;
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;
void
ConditionalInterpreter
::
fStrToFloat
(
const
std
::
shared_ptr
<
AstNode
<
ConditionalTokenTypes
>>&
node
)
{
ConditionalData
*
data
=
new
ConditionalData
;
data
->
setValue
<
float
>
(
std
::
stof
(
node
->
getValue
()));
mResolution
.
push_back
(
data
);
...
...
@@ -205,7 +205,7 @@ using namespace Aidge;
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
ConditionalData
*
data
;
...
...
@@ -214,7 +214,7 @@ using namespace Aidge;
}
catch
(
const
std
::
exception
&
e
)
{
std
::
ostringstream
errorMessage
;
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
();
...
...
@@ -224,7 +224,7 @@ using namespace Aidge;
void
ConditionalInterpreter
::
fEq
(
void
)
{
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
b
=
mResolution
[
1
];
...
...
@@ -256,7 +256,7 @@ using namespace Aidge;
void
ConditionalInterpreter
::
fNeq
(
void
)
{
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
b
=
mResolution
[
1
];
...
...
@@ -285,7 +285,7 @@ using namespace Aidge;
void
ConditionalInterpreter
::
fAnd
(
void
)
{
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
b
=
mResolution
[
1
];
...
...
@@ -297,7 +297,7 @@ using namespace Aidge;
ConditionalData
*
data
=
new
ConditionalData
;
data
->
setValue
<
bool
>
(
a
->
getValue
<
bool
>
()
&&
b
->
getValue
<
bool
>
());
clearRes
();
mResolution
.
push_back
(
data
);
...
...
@@ -306,7 +306,7 @@ using namespace Aidge;
void
ConditionalInterpreter
::
fOr
(
void
)
{
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
b
=
mResolution
[
1
];
...
...
@@ -318,7 +318,7 @@ using namespace Aidge;
ConditionalData
*
data
=
new
ConditionalData
;
data
->
setValue
<
bool
>
(
a
->
getValue
<
bool
>
()
||
b
->
getValue
<
bool
>
());
clearRes
();
mResolution
.
push_back
(
data
);
...
...
@@ -327,7 +327,7 @@ using namespace Aidge;
void
ConditionalInterpreter
::
fNot
()
{
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
];
...
...
@@ -337,7 +337,7 @@ using namespace Aidge;
ConditionalData
*
data
=
new
ConditionalData
;
data
->
setValue
<
bool
>
(
!
a
->
getValue
<
bool
>
()
);
clearRes
();
mResolution
.
push_back
(
data
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment