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
88163ec1
Commit
88163ec1
authored
Jun 05, 2019
by
Przemyslaw Tredak
Committed by
Tianqi Chen
Jun 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ghost nodes in NNVM graph (#3290)
parent
165aa0db
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
nnvm/include/nnvm/op_attr_types.h
+11
-0
nnvm/src/core/graph.cc
+3
-0
No files found.
nnvm/include/nnvm/op_attr_types.h
View file @
88163ec1
...
...
@@ -137,6 +137,17 @@ using FInferType = FInferNodeEntryAttr<int>;
using
TIsBackward
=
bool
;
/*!
* \brief Whether this op is a ghost node.
* If TIsGhost is true:
* - The node with this op will not be visible in the indexed graph.
*
* \note Register under "TIsGhost"
* This enables shape/type inference for backward nodes when
* fusion is present.
*/
using
TIsGhost
=
bool
;
/*!
* \brief Get possible inplace options.
* This function enables optimization to reuse memory of inputs in output.
* \param attrs The attributes of the node
...
...
nnvm/src/core/graph.cc
View file @
88163ec1
...
...
@@ -76,6 +76,8 @@ IndexedGraph::IndexedGraph(const Graph &g) {
DFSVisit
(
g
.
outputs
,
[
this
,
&
inputs_rptr
,
&
control_rptr
,
&
subgraphs
]
(
const
NodePtr
&
n
)
{
const
auto
&
is_ghost
=
Op
::
GetAttr
<
TIsGhost
>
(
"TIsGhost"
);
if
(
!
n
->
is_variable
()
&&
is_ghost
.
get
(
n
->
op
(),
false
))
return
;
CHECK_LT
(
nodes_
.
size
(),
std
::
numeric_limits
<
uint32_t
>::
max
());
uint32_t
nid
=
static_cast
<
uint32_t
>
(
nodes_
.
size
());
CHECK
(
n
);
...
...
@@ -103,6 +105,7 @@ IndexedGraph::IndexedGraph(const Graph &g) {
inputs_rptr
.
push_back
(
input_entries_
.
size
());
// control deps
for
(
const
auto
&
nptr
:
n
->
control_deps
)
{
if
(
!
nptr
->
is_variable
()
&&
is_ghost
.
get
(
nptr
->
op
(),
false
))
continue
;
auto
it
=
node2index_
.
find
(
nptr
.
get
());
CHECK
(
it
!=
node2index_
.
end
()
&&
it
->
first
==
nptr
.
get
());
control_deps_
.
push_back
(
it
->
second
);
...
...
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