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
90e4dd6e
Commit
90e4dd6e
authored
Nov 06, 2017
by
Yuwei Hu
Committed by
Tianqi Chen
May 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TOP] fix weight layout in conv2d_transpose (#220)
* update tvm * [TOP] fix weight layout in conv2d_transpose
parent
249f42f4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
9 deletions
+6
-9
nnvm/src/top/nn/convolution.cc
+3
-6
nnvm/tests/python/compiler/test_top_level2.py
+3
-3
No files found.
nnvm/src/top/nn/convolution.cc
View file @
90e4dd6e
...
...
@@ -150,14 +150,11 @@ inline bool Conv2DTransposeInferShape(const nnvm::NodeAttrs& attrs,
CHECK_EQ
(
param
.
dilation
.
ndim
(),
2U
)
<<
"incorrect dilate size: "
<<
param
.
dilation
;
TShape
wshape
({
param
.
channels
/
param
.
groups
,
dshape_nchw
[
1
]
/
param
.
groups
,
TShape
wshape
({
dshape_nchw
[
1
]
,
param
.
channels
/
param
.
groups
,
param
.
kernel_size
[
0
],
param
.
kernel_size
[
1
]});
wshape
=
ConvertLayout
(
wshape
,
kNCHW
,
param
.
layout
);
wshape
[
0
]
*=
param
.
groups
;
NNVM_ASSIGN_INPUT_SHAPE
(
attrs
,
*
in_shape
,
Conv2DTransposeParam
::
kWeight
,
wshape
);
if
(
param
.
use_bias
)
{
...
...
@@ -192,7 +189,7 @@ said convolution.
- **data**: This depends on the `layout` parameter. Input is 4D array of shape
(batch_size, in_channels, height, width) if `layout` is `NCHW`.
- **weight**: (
channels, in_
channels, kernel_size[0], kernel_size[1])
- **weight**: (
in_channels,
channels, kernel_size[0], kernel_size[1])
- **bias**: (channels,)
- **out**: This depends on the `layout` parameter. Output is 4D array of shape
(batch_size, channels, out_height, out_width) if `layout` is `NCHW`.
...
...
nnvm/tests/python/compiler/test_top_level2.py
View file @
90e4dd6e
...
...
@@ -60,7 +60,7 @@ def test_conv2d_transpose():
name
=
"y"
,
padding
=
(
1
,
1
),
output_padding
=
(
2
,
2
))
dtype
=
"float32"
dshape
=
(
1
,
3
,
18
,
18
)
kshape
=
(
10
,
3
,
3
,
3
)
kshape
=
(
3
,
10
,
3
,
3
)
oshape
=
(
1
,
10
,
37
,
37
)
shape_dict
=
{
"x"
:
dshape
}
for
target
,
ctx
in
ctx_list
():
...
...
@@ -68,12 +68,12 @@ def test_conv2d_transpose():
m
=
graph_runtime
.
create
(
graph
,
lib
,
ctx
)
data
=
tvm
.
nd
.
array
(
np
.
random
.
uniform
(
size
=
dshape
)
.
astype
(
dtype
))
kernel
=
tvm
.
nd
.
array
(
np
.
random
.
uniform
(
size
=
kshape
)
.
astype
(
dtype
))
bias
=
tvm
.
nd
.
array
(
np
.
random
.
uniform
(
size
=
kshape
[
0
])
.
astype
(
dtype
))
bias
=
tvm
.
nd
.
array
(
np
.
random
.
uniform
(
size
=
kshape
[
1
])
.
astype
(
dtype
))
m
.
run
(
x
=
data
,
y_weight
=
kernel
,
y_bias
=
bias
)
out
=
m
.
get_output
(
0
,
tvm
.
nd
.
empty
(
oshape
,
dtype
))
c_np
=
topi
.
testing
.
conv2d_transpose_nchw_python
(
data
.
asnumpy
(),
kernel
.
asnumpy
(),
2
,
1
)
c_np
=
c_np
+
bias
.
asnumpy
()
.
reshape
(
kshape
[
0
],
1
,
1
)
c_np
=
c_np
+
bias
.
asnumpy
()
.
reshape
(
kshape
[
1
],
1
,
1
)
d_np
=
np
.
zeros
(
shape
=
oshape
)
d_np
[:,:,
0
:
c_np
.
shape
[
2
],
0
:
c_np
.
shape
[
3
]]
=
c_np
np
.
testing
.
assert_allclose
(
out
.
asnumpy
(),
d_np
,
rtol
=
1e-5
)
...
...
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