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
1ebf4e6a
Unverified
Commit
1ebf4e6a
authored
Jun 23, 2018
by
Nick Korovaiko
Committed by
GitHub
Jun 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move is_unreachable to ngrapH_util.cpp (#1144)
parent
f15877e2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
30 deletions
+32
-30
graph_util.cpp
src/ngraph/graph_util.cpp
+29
-0
graph_util.hpp
src/ngraph/graph_util.hpp
+2
-0
cpu_rnn_fusion.cpp
src/ngraph/runtime/cpu/pass/cpu_rnn_fusion.cpp
+1
-30
No files found.
src/ngraph/graph_util.cpp
View file @
1ebf4e6a
...
...
@@ -434,3 +434,32 @@ bool ngraph::is_one(std::shared_ptr<Node> reduce_constant)
auto
result_bool
=
is_equal_to_const_value
(
"1"
,
reduce_constant
);
return
result_bool
;
}
bool
ngraph
::
is_used
(
std
::
shared_ptr
<
ngraph
::
Node
>
node
)
{
std
::
unordered_set
<
std
::
shared_ptr
<
ngraph
::
Node
>>
instances_seen
;
std
::
deque
<
std
::
shared_ptr
<
ngraph
::
Node
>>
stack
;
stack
.
push_front
(
node
);
while
(
stack
.
size
()
>
0
)
{
std
::
shared_ptr
<
ngraph
::
Node
>
n
=
stack
.
front
();
if
(
instances_seen
.
count
(
n
)
==
0
)
{
if
(
n
->
is_output
())
{
return
true
;
}
instances_seen
.
insert
(
n
);
}
stack
.
pop_front
();
for
(
auto
arg
:
n
->
get_users
())
{
if
(
instances_seen
.
count
(
arg
)
==
0
)
{
stack
.
push_front
(
arg
);
}
}
}
return
false
;
}
src/ngraph/graph_util.hpp
View file @
1ebf4e6a
...
...
@@ -131,4 +131,6 @@ namespace ngraph
bool
is_zero
(
std
::
shared_ptr
<
Node
>
reduce_constant
);
bool
is_one
(
std
::
shared_ptr
<
Node
>
reduce_constant
);
bool
is_used
(
std
::
shared_ptr
<
Node
>
node
);
}
src/ngraph/runtime/cpu/pass/cpu_rnn_fusion.cpp
View file @
1ebf4e6a
...
...
@@ -319,35 +319,6 @@ static std::shared_ptr<ngraph::Node>
}
}
static
bool
is_unreachable
(
std
::
shared_ptr
<
ngraph
::
Node
>
node
)
{
std
::
unordered_set
<
std
::
shared_ptr
<
ngraph
::
Node
>>
instances_seen
;
std
::
deque
<
std
::
shared_ptr
<
ngraph
::
Node
>>
stack
;
stack
.
push_front
(
node
);
while
(
stack
.
size
()
>
0
)
{
std
::
shared_ptr
<
ngraph
::
Node
>
n
=
stack
.
front
();
if
(
instances_seen
.
count
(
n
)
==
0
)
{
if
(
n
->
is_output
())
{
return
false
;
}
instances_seen
.
insert
(
n
);
}
stack
.
pop_front
();
for
(
auto
arg
:
n
->
get_users
())
{
if
(
instances_seen
.
count
(
arg
)
==
0
)
{
stack
.
push_front
(
arg
);
}
}
}
return
true
;
}
void
ngraph
::
runtime
::
cpu
::
pass
::
RNNFusion
::
construct_rnn_lstm_fprop
()
{
auto
ht_1
=
std
::
make_shared
<
pattern
::
op
::
Label
>
(
element
::
f32
,
Shape
{
32
,
100
});
...
...
@@ -568,7 +539,7 @@ void ngraph::runtime::cpu::pass::RNNFusion::construct_rnn_lstm_fprop()
{
if
(
std
::
find
(
lstm_nodes
.
begin
(),
lstm_nodes
.
end
(),
goe0_user
)
==
lstm_nodes
.
end
()
&&
!
is_unreachable
(
goe0_user
))
ngraph
::
is_used
(
goe0_user
))
{
lstm_goe0_user
.
insert
(
goe0_user
);
map_goe_to_lstm_slices
[
goe_0
]
=
ht_slice_per_timestep
[
index
];
...
...
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