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
36473a8a
Commit
36473a8a
authored
Jul 18, 2018
by
Nick Korovaiko
Committed by
Robert Kimball
Jul 18, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inplace results (#1162)
* inplace results * fix parameter propagation * fix python tests
parent
f078800c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
cpu_external_function.cpp
src/ngraph/runtime/cpu/cpu_external_function.cpp
+40
-0
cpu_external_function.hpp
src/ngraph/runtime/cpu/cpu_external_function.hpp
+2
-0
No files found.
src/ngraph/runtime/cpu/cpu_external_function.cpp
View file @
36473a8a
...
...
@@ -659,7 +659,10 @@ using namespace ngraph::runtime;
{
shared_ptr
<
descriptor
::
TensorView
>
itv
=
res
->
get_inputs
().
at
(
0
).
get_output
().
get_tensor_view
();
auto
output_name
=
ss
.
str
();
m_variable_name_map
[
itv
->
get_tensor
().
get_name
()]
=
ss
.
str
();
propagate_in_place_output
(
&
(
res
->
get_inputs
().
at
(
0
).
get_output
()),
output_name
);
}
}
...
...
@@ -954,6 +957,43 @@ using namespace ngraph::runtime;
}
}
void
runtime
::
cpu
::
CPU_ExternalFunction
::
propagate_in_place_output
(
ngraph
::
descriptor
::
Output
*
res_src_output
,
std
::
string
output_name
)
{
//we start with a particular output
//which is an argument to a given op::Result
size_t
offset
=
res_src_output
->
get_tensor
().
get_pool_offset
();
auto
it
=
res_src_output
;
bool
propagate_further
=
false
;
do
{
propagate_further
=
false
;
auto
arg
=
std
::
dynamic_pointer_cast
<
ngraph
::
op
::
Op
>
(
it
->
get_node
());
if
(
!
arg
)
{
break
;
}
if
(
auto
op_annotations
=
arg
->
get_op_annotations
())
{
auto
oi_pairs
=
op_annotations
->
get_in_place_oi_pairs
();
if
(
oi_pairs
.
count
(
it
->
get_index
())
!=
0
)
{
size_t
input_index
=
oi_pairs
.
at
(
it
->
get_index
());
auto
&
input_tensor
=
arg
->
get_inputs
().
at
(
input_index
).
get_tensor
();
if
(
input_tensor
.
get_pool_offset
()
==
offset
&&
!
arg
->
get_inputs
().
at
(
input_index
).
get_output
().
get_node
()
->
is_parameter
())
{
NGRAPH_DEBUG
<<
"Reusing "
<<
output_name
<<
" for "
<<
input_tensor
.
get_name
();
m_variable_name_map
[
input_tensor
.
get_name
()]
=
output_name
;
it
=
&
arg
->
get_inputs
().
at
(
input_index
).
get_output
();
propagate_further
=
true
;
}
}
}
}
while
(
propagate_further
);
}
void
runtime
::
cpu
::
CPU_ExternalFunction
::
build
()
{
if
(
m_is_built
)
...
...
src/ngraph/runtime/cpu/cpu_external_function.hpp
View file @
36473a8a
...
...
@@ -111,6 +111,8 @@ namespace ngraph
void
compile
();
private
:
void
propagate_in_place_output
(
ngraph
::
descriptor
::
Output
*
res_src_output
,
std
::
string
output_name
);
void
emit_debug_function_entry
(
codegen
::
CodeWriter
&
writer
,
Node
*
node
,
const
std
::
vector
<
TensorViewWrapper
>&
in
,
...
...
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