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
1c965079
Commit
1c965079
authored
Aug 24, 2017
by
Scott Cyphers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inverse arguments, missing file in last PR
parent
2bb6d51d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
node.hpp
src/ngraph/node.hpp
+10
-0
build_graph.cpp
test/build_graph.cpp
+4
-4
No files found.
src/ngraph/node.hpp
View file @
1c965079
...
...
@@ -15,6 +15,7 @@
#pragma once
#include <vector>
#include <set>
#include "ngraph/type.hpp"
...
...
@@ -30,18 +31,27 @@ namespace ngraph
class
Node
:
public
TypedValueMixin
{
public
:
using
ptr
=
std
::
shared_ptr
<
Node
>
;
Node
(
const
std
::
vector
<
Node
::
ptr
>&
arguments
,
ValueType
::
ptr
type
=
nullptr
)
:
TypedValueMixin
(
type
)
,
m_arguments
(
arguments
)
{
// Add this node as a user of each argument.
for
(
auto
node
:
m_arguments
){
node
->
m_users
.
insert
(
node
.
get
());
}
}
const
std
::
vector
<
Node
::
ptr
>
arguments
()
const
{
return
m_arguments
;
}
std
::
vector
<
Node
::
ptr
>
arguments
()
{
return
m_arguments
;
}
const
std
::
multiset
<
Node
*>
users
()
const
{
return
m_users
;
}
std
::
multiset
<
Node
*>
users
()
{
return
m_users
;
}
protected
:
std
::
vector
<
Node
::
ptr
>
m_arguments
;
std
::
multiset
<
Node
*>
m_users
;
};
}
test/build_graph.cpp
View file @
1c965079
...
...
@@ -31,12 +31,12 @@ TEST(graph, build_simple)
auto
arg3
=
cluster_0
->
parameter
(
3
);
// call broadcast op on arg3, broadcasting on axis 1.
auto
broadcast_1
=
op
::
broadcast
(
arg3
,
1
);
auto
arg2
=
cluster_0
->
parameter
(
2
);
auto
arg0
=
cluster_0
->
parameter
(
0
);
auto
arg2
=
cluster_0
->
parameter
(
2
);
auto
arg0
=
cluster_0
->
parameter
(
0
);
// call dot op
auto
dot
=
op
::
dot
(
arg2
,
arg0
);
ASSERT_EQ
(
dot
->
depend
ents
()[
0
],
arg2
);
ASSERT_EQ
(
dot
->
depend
ents
()[
1
],
arg0
);
ASSERT_EQ
(
dot
->
argum
ents
()[
0
],
arg2
);
ASSERT_EQ
(
dot
->
argum
ents
()[
1
],
arg0
);
// Function returns tuple of dot and broadcast_1.
cluster_0
->
result
()
->
value
(
dot
);
...
...
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