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
64a3132b
Commit
64a3132b
authored
1 year ago
by
vincent lorrain
Browse files
Options
Downloads
Patches
Plain Diff
add CI
parent
8d0dd5ed
No related branches found
No related tags found
1 merge request
!49
Add feature/graph regex/query resolution
Pipeline
#34253
passed
1 year ago
Stage: static_analysis
Stage: build
Stage: test
Stage: coverage
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unit_tests/graphRegex/Test_GraphRegex.cpp
+63
-4
63 additions, 4 deletions
unit_tests/graphRegex/Test_GraphRegex.cpp
with
63 additions
and
4 deletions
unit_tests/graphRegex/Test_GraphRegex.cpp
+
63
−
4
View file @
64a3132b
...
@@ -2,6 +2,15 @@
...
@@ -2,6 +2,15 @@
#include
<catch2/catch_test_macros.hpp>
#include
<catch2/catch_test_macros.hpp>
#include
"aidge/graphRegex/GraphRegex.hpp"
#include
"aidge/graphRegex/GraphRegex.hpp"
#include
"aidge/data/Tensor.hpp"
#include
"aidge/graph/GraphView.hpp"
#include
"aidge/operator/Add.hpp"
#include
"aidge/operator/FC.hpp"
#include
"aidge/operator/MatMul.hpp"
#include
"aidge/operator/Producer.hpp"
#include
"aidge/utils/Recipies.hpp"
#include
"aidge/operator/Conv.hpp"
#include
"aidge/operator/Conv.hpp"
#include
"aidge/operator/GenericOperator.hpp"
#include
"aidge/operator/GenericOperator.hpp"
...
@@ -47,12 +56,8 @@ TEST_CASE("GraphRegexUser") {
...
@@ -47,12 +56,8 @@ TEST_CASE("GraphRegexUser") {
}
}
SECTION
(
"CC"
)
{
SECTION
(
"CC"
)
{
std
::
shared_ptr
<
GraphRegex
>
sut
=
std
::
make_shared
<
GraphRegex
>
();
std
::
shared_ptr
<
GraphRegex
>
sut
=
std
::
make_shared
<
GraphRegex
>
();
std
::
shared_ptr
<
GraphView
>
g1
=
std
::
make_shared
<
GraphView
>
(
"TestGraph"
);
std
::
shared_ptr
<
GraphView
>
g1
=
std
::
make_shared
<
GraphView
>
(
"TestGraph"
);
std
::
shared_ptr
<
Node
>
conv
=
GenericOperator
(
"Conv"
,
1
,
1
,
1
,
"c"
);
std
::
shared_ptr
<
Node
>
conv
=
GenericOperator
(
"Conv"
,
1
,
1
,
1
,
"c"
);
std
::
shared_ptr
<
Node
>
conv1
=
GenericOperator
(
"Conv"
,
1
,
1
,
1
,
"c1"
);
std
::
shared_ptr
<
Node
>
conv1
=
GenericOperator
(
"Conv"
,
1
,
1
,
1
,
"c1"
);
...
@@ -81,4 +86,58 @@ TEST_CASE("GraphRegexUser") {
...
@@ -81,4 +86,58 @@ TEST_CASE("GraphRegexUser") {
}
}
}
}
SECTION
(
"Applied Recipes"
){
// generate the original GraphView
auto
matmul0
=
MatMul
(
5
,
"matmul0"
);
auto
add0
=
Add
<
2
>
(
"add0"
);
auto
matmul1
=
MatMul
(
5
,
"matmul1"
);
auto
add1
=
Add
<
2
>
(
"add1"
);
auto
b0
=
Producer
({
5
},
"B0"
);
auto
w0
=
Producer
({
5
,
5
},
"W0"
);
auto
b1
=
Producer
({
5
},
"B1"
);
auto
w1
=
Producer
({
5
,
5
},
"W1"
);
auto
input
=
Producer
({
2
,
5
},
"input"
);
input
->
addChild
(
matmul0
,
0
,
0
);
w0
->
addChild
(
matmul0
,
0
,
1
);
matmul0
->
addChild
(
add0
,
0
,
0
);
b0
->
addChild
(
add0
,
0
,
1
);
add0
->
addChild
(
matmul1
,
0
,
0
);
w1
->
addChild
(
matmul1
,
0
,
1
);
matmul1
->
addChild
(
add1
,
0
,
0
);
b1
->
addChild
(
add1
,
0
,
1
);
auto
fc
=
GenericOperator
(
"FC"
,
1
,
1
,
1
,
"c"
);
auto
fl
=
GenericOperator
(
"Flatten"
,
1
,
1
,
1
,
"c"
);
auto
g
=
std
::
make_shared
<
GraphView
>
();
g
->
add
({
matmul0
,
add0
,
matmul1
,
add1
,
b0
,
b1
,
fl
,
fc
});
std
::
shared_ptr
<
GraphRegex
>
kitchenBook
=
std
::
make_shared
<
GraphRegex
>
();
kitchenBook
->
setNodeKey
(
"Add"
,
"getType($) =='Add'"
);
kitchenBook
->
setNodeKey
(
"MatMul"
,
"getType($) =='MatMul'"
);
kitchenBook
->
setNodeKey
(
"Flatten"
,
"getType($) =='Flatten'"
);
kitchenBook
->
setNodeKey
(
"FC"
,
"getType($) =='FC'"
);
kitchenBook
->
addQuery
(
"MatMul->Add"
,
static_cast
<
void
(
*
)(
std
::
shared_ptr
<
MatchSolution
>
)
>
(
fuseMulAdd
));
kitchenBook
->
addQuery
(
"Flatten->FC"
,
static_cast
<
void
(
*
)(
std
::
shared_ptr
<
MatchSolution
>
)
>
(
removeFlatten
));
kitchenBook
->
appliedRecipes
(
g
);
std
::
set
<
std
::
shared_ptr
<
Node
>>
newNodes
=
g
->
getNodes
();
REQUIRE
(
newNodes
!=
std
::
set
<
std
::
shared_ptr
<
Node
>>
({
w0
,
matmul0
,
b0
,
add0
,
w1
,
matmul1
,
b1
,
add1
,
fc
}));
//REQUIRE(newNodes.size() == 6);
}
}
}
\ No newline at end of file
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