Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
b2c082c4
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b2c082c4
编写于
3月 05, 2019
作者:
Q
Qiao Longfei
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of
https://github.com/PaddlePaddle/Paddle
into add-async-ssa-graph-executor
上级
8744f9a0
02c106c7
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
73 addition
and
41 deletion
+73
-41
paddle/fluid/API.spec
paddle/fluid/API.spec
+1
-1
paddle/fluid/operators/conv_transpose_op.cc
paddle/fluid/operators/conv_transpose_op.cc
+6
-0
python/paddle/fluid/tests/unittests/mkldnn/test_conv2d_transpose_mkldnn_op.py
...tests/unittests/mkldnn/test_conv2d_transpose_mkldnn_op.py
+66
-40
未找到文件。
paddle/fluid/API.spec
浏览文件 @
b2c082c4
...
@@ -11,7 +11,7 @@ paddle.fluid.default_main_program (ArgSpec(args=[], varargs=None, keywords=None,
...
@@ -11,7 +11,7 @@ paddle.fluid.default_main_program (ArgSpec(args=[], varargs=None, keywords=None,
paddle.fluid.program_guard (ArgSpec(args=['main_program', 'startup_program'], varargs=None, keywords=None, defaults=(None,)), ('document', 'b54f403e57825a1592aece03afe3afb6'))
paddle.fluid.program_guard (ArgSpec(args=['main_program', 'startup_program'], varargs=None, keywords=None, defaults=(None,)), ('document', 'b54f403e57825a1592aece03afe3afb6'))
paddle.fluid.name_scope (ArgSpec(args=['prefix'], varargs=None, keywords=None, defaults=(None,)), ('document', '0ef753f5cec69fef9ae6ad8b867b33a2'))
paddle.fluid.name_scope (ArgSpec(args=['prefix'], varargs=None, keywords=None, defaults=(None,)), ('document', '0ef753f5cec69fef9ae6ad8b867b33a2'))
paddle.fluid.Executor.__init__ (ArgSpec(args=['self', 'place'], varargs=None, keywords=None, defaults=None), ('document', '6adf97f83acf6453d4a6a4b1070f3754'))
paddle.fluid.Executor.__init__ (ArgSpec(args=['self', 'place'], varargs=None, keywords=None, defaults=None), ('document', '6adf97f83acf6453d4a6a4b1070f3754'))
paddle.fluid.Executor.close (ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None), ('document', '
78e512cabeda9c7f42cb7c7e88967ae7
'))
paddle.fluid.Executor.close (ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None), ('document', '
f5369953dd0c443961cf79f7a00e1a03
'))
paddle.fluid.Executor.run (ArgSpec(args=['self', 'program', 'feed', 'fetch_list', 'feed_var_name', 'fetch_var_name', 'scope', 'return_numpy', 'use_program_cache'], varargs=None, keywords=None, defaults=(None, None, None, 'feed', 'fetch', None, True, False)), ('document', 'aba8093edebf2d5c869b735b92811e45'))
paddle.fluid.Executor.run (ArgSpec(args=['self', 'program', 'feed', 'fetch_list', 'feed_var_name', 'fetch_var_name', 'scope', 'return_numpy', 'use_program_cache'], varargs=None, keywords=None, defaults=(None, None, None, 'feed', 'fetch', None, True, False)), ('document', 'aba8093edebf2d5c869b735b92811e45'))
paddle.fluid.global_scope (ArgSpec(args=[], varargs=None, keywords=None, defaults=None), ('document', 'e148d3ab1ed8edf3e928212a375959c0'))
paddle.fluid.global_scope (ArgSpec(args=[], varargs=None, keywords=None, defaults=None), ('document', 'e148d3ab1ed8edf3e928212a375959c0'))
paddle.fluid.scope_guard (ArgSpec(args=['scope'], varargs=None, keywords=None, defaults=None), ('document', 'b94d1f6bcc29c4fb58fc0058561250c2'))
paddle.fluid.scope_guard (ArgSpec(args=['scope'], varargs=None, keywords=None, defaults=None), ('document', 'b94d1f6bcc29c4fb58fc0058561250c2'))
...
...
paddle/fluid/operators/conv_transpose_op.cc
浏览文件 @
b2c082c4
...
@@ -127,6 +127,12 @@ void Conv2DTransposeOpMaker::Make() {
...
@@ -127,6 +127,12 @@ void Conv2DTransposeOpMaker::Make() {
"output feature channels,"
"output feature channels,"
"H is the height of the filter, and W is the width of the filter. "
"H is the height of the filter, and W is the width of the filter. "
"We enforce groups number == 1 in the convolution transpose scenario."
);
"We enforce groups number == 1 in the convolution transpose scenario."
);
AddInput
(
"Bias"
,
"(Tensor) Bias to be added to each output of filter application."
"The format of output tensor is X (one-dimensional) of size equal"
"to the number of output channels. Only used with MKL-DNN."
)
.
AsDispensable
();
AddOutput
(
"Output"
,
AddOutput
(
"Output"
,
"(Tensor) The output tensor of convolution transpose operator. "
"(Tensor) The output tensor of convolution transpose operator. "
"The format of output tensor is also NCHW."
);
"The format of output tensor is also NCHW."
);
...
...
python/paddle/fluid/tests/unittests/mkldnn/test_conv2d_transpose_mkldnn_op.py
浏览文件 @
b2c082c4
...
@@ -15,36 +15,22 @@
...
@@ -15,36 +15,22 @@
from
__future__
import
print_function
from
__future__
import
print_function
import
unittest
import
unittest
import
numpy
as
np
import
paddle.fluid.core
as
core
from
paddle.fluid.tests.unittests.op_test
import
OpTest
from
paddle.fluid.tests.unittests.test_conv2d_transpose_op
import
TestConv2dTransposeOp
,
TestWithPad
,
TestWithStride
from
paddle.fluid.tests.unittests.test_conv2d_transpose_op
import
conv2dtranspose_forward_naive
,
TestConv2dTransposeOp
class
TestMKLDNN
(
TestConv2dTransposeOp
):
def
conv2d_bias_naive
(
out
,
bias
):
def
init_op_type
(
self
):
_
,
out_c
,
_
,
_
=
out
.
shape
self
.
is_test
=
True
self
.
use_mkldnn
=
True
self
.
data_format
=
"NCHW"
self
.
op_type
=
"conv2d_transpose"
self
.
_cpu_only
=
True
def
test_check_grad
(
self
):
return
def
test_check_grad_no_input
(
self
):
for
l
in
range
(
out_c
):
return
out
[:,
l
,
:,
:]
=
out
[:,
l
,
:,
:]
+
bias
[
l
]
return
out
def
test_check_grad_no_filter
(
self
):
return
class
TestMKLDNNWithPad
(
TestWithPad
):
class
TestConv2dTransposeMKLDNNOp
(
TestConv2dTransposeOp
):
def
init_op_type
(
self
):
self
.
is_test
=
True
self
.
use_mkldnn
=
True
self
.
data_format
=
"NCHW"
self
.
op_type
=
"conv2d_transpose"
self
.
_cpu_only
=
True
def
test_check_grad
(
self
):
def
test_check_grad
(
self
):
return
return
...
@@ -54,24 +40,64 @@ class TestMKLDNNWithPad(TestWithPad):
...
@@ -54,24 +40,64 @@ class TestMKLDNNWithPad(TestWithPad):
def
test_check_grad_no_filter
(
self
):
def
test_check_grad_no_filter
(
self
):
return
return
class
TestMKLDNNWithStride
(
TestWithStride
):
def
init_op_type
(
self
):
def
init_op_type
(
self
):
self
.
is_test
=
True
self
.
use_mkldnn
=
True
self
.
data_format
=
"NCHW"
self
.
data_format
=
"NCHW"
self
.
op_type
=
"conv2d_transpose"
self
.
op_type
=
"conv2d_transpose"
self
.
_cpu_only
=
True
self
.
_cpu_only
=
True
def
test_check_grad
(
self
):
def
init_test_case
(
self
):
return
self
.
use_mkldnn
=
True
self
.
is_test
=
True
def
test_check_grad_no_input
(
self
):
self
.
pad
=
[
0
,
0
]
return
self
.
fuse_bias
=
False
self
.
bias_size
=
None
def
test_check_grad_no_filter
(
self
):
self
.
fuse_relu
=
False
return
self
.
stride
=
[
1
,
1
]
self
.
dilations
=
[
1
,
1
]
self
.
input_size
=
[
2
,
3
,
5
,
5
]
# NCHW
if
__name__
==
'__main__'
:
f_c
=
self
.
input_size
[
1
]
unittest
.
main
()
self
.
filter_size
=
[
f_c
,
6
,
3
,
3
]
self
.
groups
=
1
def
setUp
(
self
):
TestConv2dTransposeOp
.
setUp
(
self
)
output
=
self
.
outputs
[
'Output'
]
if
self
.
fuse_bias
and
self
.
bias_size
is
not
None
:
bias
=
np
.
random
.
random
(
self
.
bias_size
).
astype
(
self
.
dtype
)
output
=
conv2d_bias_naive
(
output
,
bias
)
output
=
output
.
astype
(
self
.
dtype
)
self
.
attrs
[
'fuse_bias'
]
=
self
.
fuse_bias
self
.
inputs
[
'Bias'
]
=
OpTest
.
np_dtype_to_fluid_dtype
(
bias
)
if
self
.
fuse_relu
:
output
=
np
.
maximum
(
output
,
0
).
astype
(
self
.
dtype
)
self
.
attrs
[
'fuse_bias'
]
=
self
.
fuse_bias
self
.
attrs
[
'fuse_relu'
]
=
self
.
fuse_relu
self
.
outputs
[
'Output'
]
=
output
class
TestMKLDNNFuseBias
(
TestConv2dTransposeMKLDNNOp
):
def
init_test_case
(
self
):
TestConv2dTransposeMKLDNNOp
.
init_test_case
(
self
)
self
.
pad
=
[
1
,
1
]
self
.
fuse_bias
=
True
self
.
bias_size
=
[
6
]
class
TestMKLDNNWithPad
(
TestConv2dTransposeMKLDNNOp
):
def
init_test_case
(
self
):
TestConv2dTransposeMKLDNNOp
.
init_test_case
(
self
)
self
.
pad
=
[
1
,
1
]
self
.
input_size
=
[
2
,
3
,
10
,
10
]
class
TestMKLDNNWithStride
(
TestConv2dTransposeMKLDNNOp
):
def
init_test_case
(
self
):
TestConv2dTransposeMKLDNNOp
.
init_test_case
(
self
)
self
.
pad
=
[
1
,
1
]
self
.
stride
=
[
2
,
2
]
self
.
input_size
=
[
2
,
3
,
6
,
6
]
# NCHW
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录