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
6fd58bac
Commit
6fd58bac
authored
1 year ago
by
Maxence Naud
Browse files
Options
Downloads
Patches
Plain Diff
[Fix] FuseMulAdd python test and fusemuladd function
parent
e98dd055
No related branches found
No related tags found
1 merge request
!9
Fuse bn
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aidge_core/unit_tests/test_recipies.py
+9
-9
9 additions, 9 deletions
aidge_core/unit_tests/test_recipies.py
src/recipies/FuseMulAdd.cpp
+3
-3
3 additions, 3 deletions
src/recipies/FuseMulAdd.cpp
with
12 additions
and
12 deletions
aidge_core/unit_tests/test_recipies.py
+
9
−
9
View file @
6fd58bac
...
@@ -60,15 +60,15 @@ class test_recipies(unittest.TestCase):
...
@@ -60,15 +60,15 @@ class test_recipies(unittest.TestCase):
aidge_core
.
fuse_mul_add
(
graph_view
)
aidge_core
.
fuse_mul_add
(
graph_view
)
self
.
assertTrue
(
len
(
graph_view
.
get_nodes
())
==
len
(
old_nodes
)
-
2
)
self
.
assertTrue
(
len
(
graph_view
.
get_nodes
())
==
len
(
old_nodes
)
-
2
)
self
.
assertTrue
(
"
MatMul0
"
not
in
[
i
.
name
for
i
in
graph_view
.
get_nodes
()])
self
.
assertTrue
(
"
MatMul0
"
not
in
[
i
.
name
()
for
i
in
graph_view
.
get_nodes
()])
self
.
assertTrue
(
"
Add0
"
not
in
[
i
.
name
for
i
in
graph_view
.
get_nodes
()])
self
.
assertTrue
(
"
Add0
"
not
in
[
i
.
name
()
for
i
in
graph_view
.
get_nodes
()])
self
.
assertTrue
(
"
MatMul1
"
not
in
[
i
.
name
for
i
in
graph_view
.
get_nodes
()])
self
.
assertTrue
(
"
MatMul1
"
not
in
[
i
.
name
()
for
i
in
graph_view
.
get_nodes
()])
self
.
assertTrue
(
"
Add1
"
not
in
[
i
.
name
for
i
in
graph_view
.
get_nodes
()])
self
.
assertTrue
(
"
Add1
"
not
in
[
i
.
name
()
for
i
in
graph_view
.
get_nodes
()])
self
.
assertTrue
(
"
W0
"
in
[
i
.
name
for
i
in
graph_view
.
get_nodes
()])
self
.
assertTrue
(
"
W0
"
in
[
i
.
name
()
for
i
in
graph_view
.
get_nodes
()])
self
.
assertTrue
(
"
B0
"
in
[
i
.
name
for
i
in
graph_view
.
get_nodes
()])
self
.
assertTrue
(
"
B0
"
in
[
i
.
name
()
for
i
in
graph_view
.
get_nodes
()])
self
.
assertTrue
(
"
W1
"
in
[
i
.
name
for
i
in
graph_view
.
get_nodes
()])
self
.
assertTrue
(
"
W1
"
in
[
i
.
name
()
for
i
in
graph_view
.
get_nodes
()])
self
.
assertTrue
(
"
B1
"
in
[
i
.
name
for
i
in
graph_view
.
get_nodes
()])
self
.
assertTrue
(
"
B1
"
in
[
i
.
name
()
for
i
in
graph_view
.
get_nodes
()])
# TODO : Vérifier que FC bien crée
# TODO : Vérifier que FC bien crée
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
src/recipies/FuseMulAdd.cpp
+
3
−
3
View file @
6fd58bac
...
@@ -58,9 +58,9 @@ void Aidge::fuseMulAdd(std::set<std::shared_ptr<Node>> nodes){
...
@@ -58,9 +58,9 @@ void Aidge::fuseMulAdd(std::set<std::shared_ptr<Node>> nodes){
// link weights & bias
// link weights & bias
if
(
matmul
->
getParent
(
1
)
==
nullptr
)
{
if
(
matmul
->
getParent
(
1
)
==
nullptr
)
{
matmul
->
getParent
(
0
)
->
addChild
(
fc
,
0
,
1
);
matmul
->
getParent
(
0
)
->
addChild
(
fc
,
0
,
1
);
printf
(
"Mat
m
ul out[1] == nullptr !
\n
"
);
printf
(
"Mat
M
ul out[1] == nullptr !
\n
"
);
}
else
{
}
else
{
printf
(
"Mat
m
ul out[1] != nullptr !
\n
"
);
printf
(
"Mat
M
ul out[1] != nullptr !
\n
"
);
if
(
matmul
->
getParent
(
0
)
!=
nullptr
)
if
(
matmul
->
getParent
(
0
)
!=
nullptr
)
matmul
->
getParent
(
0
)
->
addChild
(
fc
,
0
,
0
);
matmul
->
getParent
(
0
)
->
addChild
(
fc
,
0
,
0
);
matmul
->
input
(
1
).
first
->
addChild
(
fc
,
0
,
1
);
matmul
->
input
(
1
).
first
->
addChild
(
fc
,
0
,
1
);
...
@@ -73,7 +73,7 @@ void Aidge::fuseMulAdd(std::set<std::shared_ptr<Node>> nodes){
...
@@ -73,7 +73,7 @@ void Aidge::fuseMulAdd(std::set<std::shared_ptr<Node>> nodes){
// Case 2 : If not all nodes are in a graph view : only delete the nodes from the graphview
// Case 2 : If not all nodes are in a graph view : only delete the nodes from the graphview
// Maybe create a central mechanism to update automatically all graph views rather than each node have graphview presence memory ?
// Maybe create a central mechanism to update automatically all graph views rather than each node have graphview presence memory ?
auto
nodeToReplace
=
std
::
make_shared
<
GraphView
>
();
auto
nodeToReplace
=
std
::
make_shared
<
GraphView
>
();
nodeToReplace
->
add
(
nodes
);
nodeToReplace
->
add
(
nodes
,
false
);
nodeToReplace
->
replaceWith
({
fc
});
nodeToReplace
->
replaceWith
({
fc
});
}
}
...
...
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