Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
43d6abf0
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
43d6abf0
编写于
3月 09, 2021
作者:
W
wangguanzhong
提交者:
GitHub
3月 09, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update conv2d, test=develop (#31480)
上级
50af0c2c
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
29 addition
and
3 deletion
+29
-3
paddle/fluid/operators/conv_op.cc
paddle/fluid/operators/conv_op.cc
+8
-3
python/paddle/fluid/tests/unittests/test_functional_conv2d.py
...on/paddle/fluid/tests/unittests/test_functional_conv2d.py
+15
-0
python/paddle/nn/layer/conv.py
python/paddle/nn/layer/conv.py
+6
-0
未找到文件。
paddle/fluid/operators/conv_op.cc
浏览文件 @
43d6abf0
...
...
@@ -175,9 +175,14 @@ framework::OpKernelType ConvOp::GetExpectedKernelType(
input_data_type
!=
framework
::
proto
::
VarType
::
UINT8
&&
input_data_type
!=
framework
::
proto
::
VarType
::
BF16
)
{
auto
filter_data_type
=
ctx
.
Input
<
Tensor
>
(
"Filter"
)
->
type
();
PADDLE_ENFORCE_EQ
(
input_data_type
,
filter_data_type
,
PADDLE_ENFORCE_EQ
(
input_data_type
,
filter_data_type
,
platform
::
errors
::
InvalidArgument
(
"input and filter data type should be consistent"
));
"input and filter data type should be consistent, "
"but received input data type is %s and filter type "
"is %s"
,
paddle
::
framework
::
DataTypeToString
(
input_data_type
),
paddle
::
framework
::
DataTypeToString
(
filter_data_type
)));
}
if
(
input_data_type
==
framework
::
proto
::
VarType
::
FP16
)
{
PADDLE_ENFORCE_EQ
(
library
,
framework
::
LibraryType
::
kCUDNN
,
...
...
python/paddle/fluid/tests/unittests/test_functional_conv2d.py
浏览文件 @
43d6abf0
...
...
@@ -442,5 +442,20 @@ class TestFunctionalConv2DErrorCase10(TestFunctionalConv2DError):
self
.
data_format
=
"NHWC"
class
TestFunctionalConv2DErrorCase11
(
TestFunctionalConv2DError
):
def
setUp
(
self
):
self
.
in_channels
=
3
self
.
out_channels
=
5
self
.
filter_shape
=
3
self
.
padding
=
0
self
.
stride
=
1
self
.
dilation
=
1
self
.
groups
=
1
self
.
no_bias
=
False
self
.
act
=
"sigmoid"
self
.
use_cudnn
=
False
self
.
data_format
=
"NHCW"
if
__name__
==
"__main__"
:
unittest
.
main
()
python/paddle/nn/layer/conv.py
浏览文件 @
43d6abf0
...
...
@@ -85,6 +85,12 @@ class _ConvNd(layers.Layer):
"when padding_mode in ['reflect', 'replicate', 'circular'], type of padding must be int"
)
valid_format
=
{
'NHWC'
,
'NCHW'
,
'NDHWC'
,
'NCDHW'
,
'NLC'
,
'NCL'
}
if
data_format
not
in
valid_format
:
raise
ValueError
(
"data_format must be one of {}, but got data_format='{}'"
.
format
(
valid_format
,
data_format
))
channel_last
=
(
data_format
==
"NHWC"
)
or
(
data_format
==
"NDHWC"
)
or
(
data_format
==
"NLC"
)
if
channel_last
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录