Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
04edd05d
Commit
04edd05d
authored
Feb 24, 2017
by
Eric Junyuan Xie
Committed by
Tianqi Chen
May 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add symbol::GetChildren (#104)
parent
37c450fe
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
0 deletions
+21
-0
nnvm/amalgamation/.gitignore
+2
-0
nnvm/include/nnvm/symbolic.h
+6
-0
nnvm/src/core/symbolic.cc
+13
-0
No files found.
nnvm/amalgamation/.gitignore
0 → 100644
View file @
04edd05d
nnvm.d
nnvm.cc
nnvm/include/nnvm/symbolic.h
View file @
04edd05d
...
...
@@ -137,6 +137,12 @@ class Symbol {
* including input variables and intermediate outputs.
*/
Symbol
GetInternals
()
const
;
/*
* \brief Get the direct inputs of the head node(s) of this symbol.
* \return symbol A new symbol whose output contains all the inputs of the head
* node(s).
*/
Symbol
GetChildren
()
const
;
/*!
* \brief Set additional attributes to current node.
*
...
...
nnvm/src/core/symbolic.cc
View file @
04edd05d
...
...
@@ -435,6 +435,19 @@ Symbol Symbol::GetInternals() const {
return
ret
;
}
Symbol
Symbol
::
GetChildren
()
const
{
static
auto
&
fnum_vis_output
=
Op
::
GetAttr
<
FNumVisibleOutputs
>
(
"FNumVisibleOutputs"
);
Symbol
ret
;
std
::
unordered_set
<
Node
*>
visited
;
for
(
const
auto
&
p
:
this
->
outputs
)
{
Node
*
node
=
p
.
node
.
get
();
if
(
visited
.
count
(
node
))
continue
;
visited
.
insert
(
node
);
ret
.
outputs
.
insert
(
ret
.
outputs
.
end
(),
node
->
inputs
.
begin
(),
node
->
inputs
.
end
());
}
return
ret
;
}
void
Symbol
::
SetAttrs
(
const
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>
>&
attrs
)
{
Node
*
node
=
outputs
[
0
].
node
.
get
();
for
(
const
NodeEntry
&
e
:
outputs
)
{
...
...
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