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
e3e4f337
Unverified
Commit
e3e4f337
authored
Jun 18, 2018
by
Jayaram Bobba
Committed by
GitHub
Jun 18, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into jmenon/dex2
parents
db553dc5
eed4279e
Show 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 @
e3e4f337
...
@@ -32,11 +32,11 @@ bool ngraph::pass::GraphRewrite::run_matchers_on_nodes_list(
...
@@ -32,11 +32,11 @@ bool ngraph::pass::GraphRewrite::run_matchers_on_nodes_list(
{
{
for
(
auto
matcher
:
matchers
)
for
(
auto
matcher
:
matchers
)
{
{
NGRAPH_DEBUG
<<
"Running matcher "
<<
matcher
<<
" on "
<<
node
<<
" ,
"
NGRAPH_DEBUG
<<
"Running matcher "
<<
matcher
->
get_name
()
<<
"(
"
<<
node
->
get_name
()
<<
" , is_output = "
<<
node
->
is_output
();
<<
matcher
->
get_pattern
()
->
get_name
()
<<
") on "
<<
node
->
get_name
();
if
(
matcher
->
match
(
node
))
if
(
matcher
->
match
(
node
))
{
{
NGRAPH_DEBUG
<<
"Matcher "
<<
matcher
<<
" matched "
<<
node
<<
" ,
"
NGRAPH_DEBUG
<<
"Matcher "
<<
matcher
<<
matcher
->
get_name
()
<<
" matched
"
<<
node
->
get_name
();
<<
node
->
get_name
();
rewritten
=
true
;
rewritten
=
true
;
if
(
matcher
->
process_match
())
if
(
matcher
->
process_match
())
...
@@ -64,12 +64,10 @@ bool ngraph::pass::RecurrentGraphRewrite::run_on_function(std::shared_ptr<ngraph
...
@@ -64,12 +64,10 @@ bool ngraph::pass::RecurrentGraphRewrite::run_on_function(std::shared_ptr<ngraph
{
{
for
(
auto
matcher
:
m_matchers
)
for
(
auto
matcher
:
m_matchers
)
{
{
NGRAPH_DEBUG
<<
"Running matcher "
<<
matcher
<<
" on "
<<
node
<<
" , "
NGRAPH_DEBUG
<<
"Running matcher "
<<
matcher
<<
" on "
<<
node
->
get_name
();
<<
node
->
get_name
()
<<
" , is_output = "
<<
node
->
is_output
();
if
(
matcher
->
match
(
node
))
if
(
matcher
->
match
(
node
))
{
{
NGRAPH_DEBUG
<<
"Matcher "
<<
matcher
<<
" matched "
<<
node
<<
" , "
NGRAPH_DEBUG
<<
"Matcher "
<<
matcher
<<
" matched "
<<
node
->
get_name
();
<<
node
->
get_name
();
if
(
matcher
->
process_match
())
if
(
matcher
->
process_match
())
{
{
changed
=
true
;
changed
=
true
;
...
...
src/ngraph/pattern/matcher.hpp
View file @
e3e4f337
...
@@ -66,12 +66,15 @@ namespace ngraph
...
@@ -66,12 +66,15 @@ namespace ngraph
/// \param pattern_node is a pattern sub graph that will be matched against input graphs
/// \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
/// \param callback is a callback function that will be called on a successful match
Matcher
(
const
std
::
shared_ptr
<
Node
>
pattern_node
=
nullptr
,
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_pattern_node
(
pattern_node
)
,
m_callback
(
callback
)
,
m_callback
(
callback
)
,
m_depth
(
0
)
,
m_depth
(
0
)
,
m_name
(
name
)
{
{
}
}
virtual
~
Matcher
()
{}
virtual
~
Matcher
()
{}
/// \brief Matches a pattern to \p graph_node
/// \brief Matches a pattern to \p graph_node
///
///
...
@@ -108,6 +111,7 @@ namespace ngraph
...
@@ -108,6 +111,7 @@ namespace ngraph
bool
process_match
(
graph_rewrite_callback
callback
=
nullptr
);
bool
process_match
(
graph_rewrite_callback
callback
=
nullptr
);
void
reset
()
{}
void
reset
()
{}
std
::
string
get_name
()
{
return
m_name
;
}
std
::
shared_ptr
<
Node
>
get_pattern
()
{
return
m_pattern_node
;
}
std
::
shared_ptr
<
Node
>
get_pattern
()
{
return
m_pattern_node
;
}
std
::
shared_ptr
<
Node
>
get_match_root
();
std
::
shared_ptr
<
Node
>
get_match_root
();
PatternMap
get_pattern_map
()
{
return
PatternMap
{
m_pattern_map
};
}
PatternMap
get_pattern_map
()
{
return
PatternMap
{
m_pattern_map
};
}
...
@@ -149,6 +153,7 @@ namespace ngraph
...
@@ -149,6 +153,7 @@ namespace ngraph
graph_rewrite_callback
m_callback
;
graph_rewrite_callback
m_callback
;
size_t
m_depth
;
size_t
m_depth
;
std
::
string
m_name
;
};
};
class
RecurrentMatcher
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