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
4363d0fb
Commit
4363d0fb
authored
Dec 24, 2016
by
Tianqi Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PASS] Make placedevice compatible with backward op (#88)
parent
996ff839
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
nnvm/src/pass/place_device.cc
+12
-3
No files found.
nnvm/src/pass/place_device.cc
View file @
4363d0fb
...
...
@@ -25,6 +25,8 @@ Graph PlaceDevice(Graph src) {
const
Op
*
copy_op
=
Op
::
Get
(
src
.
GetAttr
<
std
::
string
>
(
"device_copy_op"
));
auto
&
device_assign_map
=
src
.
GetAttr
<
DeviceAssignMap
>
(
"device_assign_map"
);
const
IndexedGraph
&
idx
=
src
.
indexed_graph
();
static
auto
&
is_backward
=
Op
::
GetAttr
<
TIsBackward
>
(
"TIsBackward"
);
DeviceVector
device
;
// copy on write semanatics
if
(
src
.
attrs
.
count
(
"device"
)
!=
0
)
{
...
...
@@ -45,9 +47,16 @@ Graph PlaceDevice(Graph src) {
<<
"The device assignment not found for group "
<<
device_group
;
device
[
nid
]
=
dit
->
second
;
}
else
{
for
(
const
IndexedGraph
::
NodeEntry
&
e
:
inode
.
inputs
)
{
if
(
device
[
e
.
node_id
]
!=
-
1
)
{
device
[
nid
]
=
device
[
e
.
node_id
];
break
;
if
(
!
inode
.
source
->
is_variable
()
&&
is_backward
.
get
(
inode
.
source
->
op
(),
false
))
{
if
(
device
[
inode
.
control_deps
[
0
]]
!=
-
1
)
{
device
[
nid
]
=
device
[
inode
.
control_deps
[
0
]];
}
}
else
{
for
(
const
IndexedGraph
::
NodeEntry
&
e
:
inode
.
inputs
)
{
if
(
device
[
e
.
node_id
]
!=
-
1
)
{
device
[
nid
]
=
device
[
e
.
node_id
];
break
;
}
}
}
}
...
...
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