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
4db318a3
Unverified
Commit
4db318a3
authored
Jun 27, 2018
by
Nick Korovaiko
Committed by
GitHub
Jun 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get_output_elements (#1154)
* get_get_output_elements * fix comp error * address scott's feedback
parent
f7a34a02
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
7 deletions
+20
-7
node_vector.hpp
src/ngraph/node_vector.hpp
+5
-0
batch_norm.cpp
src/ngraph/op/batch_norm.cpp
+1
-7
get_output_element.cpp
src/ngraph/op/get_output_element.cpp
+12
-0
get_output_element.hpp
src/ngraph/op/get_output_element.hpp
+2
-0
No files found.
src/ngraph/node_vector.hpp
View file @
4db318a3
...
...
@@ -47,6 +47,11 @@ namespace ngraph
{
}
NodeVector
(
size_t
size
)
:
std
::
vector
<
std
::
shared_ptr
<
Node
>>
(
size
)
{
}
NodeVector
&
operator
=
(
const
NodeVector
&
other
)
=
default
;
NodeVector
()
{}
...
...
src/ngraph/op/batch_norm.cpp
View file @
4db318a3
...
...
@@ -265,15 +265,9 @@ void ngraph::op::BatchNorm::generate_adjoints(autodiff::Adjoints& adjoints,
//and get_n() is used to sort the inputs in the same order as Batchnorm's outputs
//Next, Mean and Variance (`at(1)` and `at(2)`) are extracted
//Please see `add_output` in `BatchNorm::BatchNorm` for more details
std
::
vector
<
std
::
shared_ptr
<
Node
>>
goes
(
get_outputs
().
size
());
if
(
this
->
get_training_flag
()
&&
get_input_size
()
==
3
)
{
for
(
auto
goe_input
:
get_output_inputs
(
0
))
{
auto
goe
=
std
::
dynamic_pointer_cast
<
op
::
GetOutputElement
>
(
goe_input
->
get_node
());
goes
.
at
(
goe
->
get_n
())
=
goe_input
->
get_node
();
}
auto
goes
=
op
::
get_output_elements
(
this
->
shared_from_this
());
mean
=
goes
.
at
(
1
);
var
=
goes
.
at
(
2
);
}
...
...
src/ngraph/op/get_output_element.cpp
View file @
4db318a3
...
...
@@ -53,3 +53,15 @@ void op::GetOutputElement::generate_adjoints(autodiff::Adjoints& adjoints, const
adjoints
.
add_delta
(
get_inputs
().
at
(
0
).
get_output
().
get_node
(),
delta
,
get_n
());
}
NodeVector
op
::
get_output_elements
(
const
std
::
shared_ptr
<
Node
>&
mon
)
{
NodeVector
goes
(
mon
->
get_outputs
().
size
());
for
(
auto
goe_input
:
mon
->
get_output_inputs
(
0
))
{
auto
goe
=
std
::
dynamic_pointer_cast
<
op
::
GetOutputElement
>
(
goe_input
->
get_node
());
goes
.
at
(
goe
->
get_n
())
=
goe_input
->
get_node
();
}
return
goes
;
}
src/ngraph/op/get_output_element.hpp
View file @
4db318a3
...
...
@@ -22,6 +22,8 @@ namespace ngraph
{
namespace
op
{
NodeVector
get_output_elements
(
const
std
::
shared_ptr
<
Node
>&
mon
);
/// \brief Operation to get an output from a node.
class
GetOutputElement
:
public
Node
{
...
...
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