Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
eed4279e
Unverified
Commit
eed4279e
authored
Jun 17, 2018
by
Nick Korovaiko
Committed by
GitHub
Jun 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
facility to name matchers to make debugging easier (#1110)
parent
bdfcf5b4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
graph_rewrite.cpp
src/ngraph/pass/graph_rewrite.cpp
+5
-7
matcher.hpp
src/ngraph/pattern/matcher.hpp
+6
-1
No files found.
src/ngraph/pass/graph_rewrite.cpp
View file @
eed4279e
...
...
@@ -32,11 +32,11 @@ bool ngraph::pass::GraphRewrite::run_matchers_on_nodes_list(
{
for
(
auto
matcher
:
matchers
)
{
NGRAPH_DEBUG
<<
"Running matcher "
<<
matcher
<<
" on "
<<
node
<<
" ,
"
<<
node
->
get_name
()
<<
" , is_output = "
<<
node
->
is_output
();
NGRAPH_DEBUG
<<
"Running matcher "
<<
matcher
->
get_name
()
<<
"(
"
<<
matcher
->
get_pattern
()
->
get_name
()
<<
") on "
<<
node
->
get_name
();
if
(
matcher
->
match
(
node
))
{
NGRAPH_DEBUG
<<
"Matcher "
<<
matcher
<<
" matched "
<<
node
<<
" ,
"
NGRAPH_DEBUG
<<
"Matcher "
<<
matcher
<<
matcher
->
get_name
()
<<
" matched
"
<<
node
->
get_name
();
rewritten
=
true
;
if
(
matcher
->
process_match
())
...
...
@@ -64,12 +64,10 @@ bool ngraph::pass::RecurrentGraphRewrite::run_on_function(std::shared_ptr<ngraph
{
for
(
auto
matcher
:
m_matchers
)
{
NGRAPH_DEBUG
<<
"Running matcher "
<<
matcher
<<
" on "
<<
node
<<
" , "
<<
node
->
get_name
()
<<
" , is_output = "
<<
node
->
is_output
();
NGRAPH_DEBUG
<<
"Running matcher "
<<
matcher
<<
" on "
<<
node
->
get_name
();
if
(
matcher
->
match
(
node
))
{
NGRAPH_DEBUG
<<
"Matcher "
<<
matcher
<<
" matched "
<<
node
<<
" , "
<<
node
->
get_name
();
NGRAPH_DEBUG
<<
"Matcher "
<<
matcher
<<
" matched "
<<
node
->
get_name
();
if
(
matcher
->
process_match
())
{
changed
=
true
;
...
...
src/ngraph/pattern/matcher.hpp
View file @
eed4279e
...
...
@@ -66,12 +66,15 @@ namespace ngraph
/// \param pattern_node is a pattern sub graph that will be matched against input graphs
/// \param callback is a callback function that will be called on a successful match
Matcher
(
const
std
::
shared_ptr
<
Node
>
pattern_node
=
nullptr
,
graph_rewrite_callback
callback
=
nullptr
)
graph_rewrite_callback
callback
=
nullptr
,
const
std
::
string
&
name
=
"Unnamed"
)
:
m_pattern_node
(
pattern_node
)
,
m_callback
(
callback
)
,
m_depth
(
0
)
,
m_name
(
name
)
{
}
virtual
~
Matcher
()
{}
/// \brief Matches a pattern to \p graph_node
///
...
...
@@ -108,6 +111,7 @@ namespace ngraph
bool
process_match
(
graph_rewrite_callback
callback
=
nullptr
);
void
reset
()
{}
std
::
string
get_name
()
{
return
m_name
;
}
std
::
shared_ptr
<
Node
>
get_pattern
()
{
return
m_pattern_node
;
}
std
::
shared_ptr
<
Node
>
get_match_root
();
PatternMap
get_pattern_map
()
{
return
PatternMap
{
m_pattern_map
};
}
...
...
@@ -149,6 +153,7 @@ namespace ngraph
graph_rewrite_callback
m_callback
;
size_t
m_depth
;
std
::
string
m_name
;
};
class
RecurrentMatcher
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment