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
343eb82c
Commit
343eb82c
authored
Apr 28, 2018
by
Yizhi Liu
Committed by
Tianqi Chen
May 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix restore layout in AlterOpLayout (#460)
* fix restore layout in AlterOpLayout * lint test case
parent
1e4bb2f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
nnvm/src/compiler/alter_op_layout.cc
+3
-2
nnvm/tests/python/compiler/test_alter_op_layout.py
+5
-1
No files found.
nnvm/src/compiler/alter_op_layout.cc
View file @
343eb82c
...
@@ -119,8 +119,9 @@ Graph AlterOpLayout(const Graph& src) {
...
@@ -119,8 +119,9 @@ Graph AlterOpLayout(const Graph& src) {
if
(
new_nodes
.
count
(
inode
.
source
))
{
if
(
new_nodes
.
count
(
inode
.
source
))
{
const
std
::
vector
<
Layout
>&
in_layouts
=
const
std
::
vector
<
Layout
>&
in_layouts
=
in_layouts_of_node
[
new_nodes
[
inode
.
source
]];
in_layouts_of_node
[
new_nodes
[
inode
.
source
]];
for
(
const
auto
&
e
:
inode
.
inputs
)
{
for
(
uint32_t
i
=
0
;
i
<
inode
.
inputs
.
size
();
++
i
)
{
ret_layouts
[
ret_idx
.
entry_id
(
e
)]
=
in_layouts
[
e
.
index
];
const
auto
&
e
=
inode
.
inputs
[
i
];
ret_layouts
[
ret_idx
.
entry_id
(
e
)]
=
in_layouts
[
i
];
}
}
const
std
::
vector
<
Layout
>&
out_layouts
=
const
std
::
vector
<
Layout
>&
out_layouts
=
out_layouts_of_node
[
new_nodes
[
inode
.
source
]];
out_layouts_of_node
[
new_nodes
[
inode
.
source
]];
...
...
nnvm/tests/python/compiler/test_alter_op_layout.py
View file @
343eb82c
...
@@ -19,10 +19,14 @@ def test_alter_conv2d_layout():
...
@@ -19,10 +19,14 @@ def test_alter_conv2d_layout():
conv
=
sym
.
conv2d
(
data
,
name
=
"conv"
,
channels
=
16
,
conv
=
sym
.
conv2d
(
data
,
name
=
"conv"
,
channels
=
16
,
kernel_size
=
(
3
,
3
),
padding
=
(
1
,
1
),
kernel_size
=
(
3
,
3
),
padding
=
(
1
,
1
),
use_bias
=
False
,
layout
=
"NCHW"
)
use_bias
=
False
,
layout
=
"NCHW"
)
relu
=
sym
.
relu
(
conv
,
name
=
"relu"
)
# split here
convs
=
sym
.
split
(
conv
,
indices_or_sections
=
2
)
relus
=
[
sym
.
relu
(
x
,
name
=
"relu"
)
for
x
in
convs
]
relu
=
sym
.
concatenate
(
*
relus
)
flatten
=
sym
.
flatten
(
relu
,
name
=
"flatten"
)
flatten
=
sym
.
flatten
(
relu
,
name
=
"flatten"
)
softmax
=
sym
.
softmax
(
flatten
,
name
=
"softmax"
)
softmax
=
sym
.
softmax
(
flatten
,
name
=
"softmax"
)
g
=
graph
.
create
(
softmax
)
g
=
graph
.
create
(
softmax
)
g
=
g
.
apply
(
"CorrectLayout"
)
g
=
g
.
apply
(
"CorrectLayout"
)
g
=
graph_attr
.
set_dtype_inputs
(
g
,
"float32"
)
g
=
graph_attr
.
set_dtype_inputs
(
g
,
"float32"
)
g
=
g
.
apply
([
"InferShape"
,
"InferType"
])
g
=
g
.
apply
([
"InferShape"
,
"InferType"
])
...
...
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