Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
cf883d9c
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
cf883d9c
编写于
2月 28, 2018
作者:
C
chengduo
提交者:
GitHub
2月 28, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #8613 from chengduoZH/feature/fix_bug_conv_op
Fix conv_op bug
上级
f449180b
a779b424
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
60 addition
and
10 deletion
+60
-10
paddle/fluid/operators/conv_op.cc
paddle/fluid/operators/conv_op.cc
+0
-6
paddle/fluid/operators/conv_op.h
paddle/fluid/operators/conv_op.h
+8
-1
paddle/fluid/operators/pool_op.cc
paddle/fluid/operators/pool_op.cc
+5
-0
python/paddle/fluid/tests/unittests/test_conv2d_op.py
python/paddle/fluid/tests/unittests/test_conv2d_op.py
+21
-1
python/paddle/fluid/tests/unittests/test_conv2d_transpose_op.py
.../paddle/fluid/tests/unittests/test_conv2d_transpose_op.py
+2
-1
python/paddle/fluid/tests/unittests/test_conv3d_op.py
python/paddle/fluid/tests/unittests/test_conv3d_op.py
+22
-0
python/paddle/fluid/tests/unittests/test_conv3d_transpose_op.py
.../paddle/fluid/tests/unittests/test_conv3d_transpose_op.py
+2
-1
未找到文件。
paddle/fluid/operators/conv_op.cc
浏览文件 @
cf883d9c
...
@@ -54,12 +54,6 @@ void ConvOp::InferShape(framework::InferShapeContext* ctx) const {
...
@@ -54,12 +54,6 @@ void ConvOp::InferShape(framework::InferShapeContext* ctx) const {
std
::
vector
<
int64_t
>
output_shape
({
in_dims
[
0
],
filter_dims
[
0
]});
std
::
vector
<
int64_t
>
output_shape
({
in_dims
[
0
],
filter_dims
[
0
]});
for
(
size_t
i
=
0
;
i
<
strides
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
strides
.
size
();
++
i
)
{
PADDLE_ENFORCE
(
in_dims
[
i
+
2
]
+
2
*
paddings
[
i
]
-
(
dilations
[
i
]
*
(
filter_dims
[
i
+
2
]
-
1
)
+
1
)
>
0
,
"Due to the settings of paddings, filter_dims and "
"dilations, the output size is less than 0, please check "
"again."
);
output_shape
.
push_back
(
ConvOutputSize
(
in_dims
[
i
+
2
],
filter_dims
[
i
+
2
],
output_shape
.
push_back
(
ConvOutputSize
(
in_dims
[
i
+
2
],
filter_dims
[
i
+
2
],
dilations
[
i
],
paddings
[
i
],
dilations
[
i
],
paddings
[
i
],
strides
[
i
]));
strides
[
i
]));
...
...
paddle/fluid/operators/conv_op.h
浏览文件 @
cf883d9c
...
@@ -31,7 +31,14 @@ using Tensor = framework::Tensor;
...
@@ -31,7 +31,14 @@ using Tensor = framework::Tensor;
inline
int
ConvOutputSize
(
int
input_size
,
int
filter_size
,
int
dilation
,
inline
int
ConvOutputSize
(
int
input_size
,
int
filter_size
,
int
dilation
,
int
padding
,
int
stride
)
{
int
padding
,
int
stride
)
{
const
int
dkernel
=
dilation
*
(
filter_size
-
1
)
+
1
;
const
int
dkernel
=
dilation
*
(
filter_size
-
1
)
+
1
;
const
int
output_size
=
(
input_size
+
2
*
padding
-
dkernel
)
/
stride
+
1
;
int
output_size
=
(
input_size
+
2
*
padding
-
dkernel
)
/
stride
+
1
;
PADDLE_ENFORCE
(
output_size
>
0
,
"Due to the settings of padding(%d), filter_size(%d), dilation(%d) and "
"stride(%d), the output size is less than 0, please check "
"again. Input_size:%d"
,
padding
,
filter_size
,
dilation
,
stride
,
input_size
);
return
output_size
;
return
output_size
;
}
}
inline
bool
IsExpand
(
std
::
vector
<
int64_t
>&
filter_dim
,
inline
bool
IsExpand
(
std
::
vector
<
int64_t
>&
filter_dim
,
...
...
paddle/fluid/operators/pool_op.cc
浏览文件 @
cf883d9c
...
@@ -19,6 +19,11 @@ namespace operators {
...
@@ -19,6 +19,11 @@ namespace operators {
int
PoolOutputSize
(
int
input_size
,
int
filter_size
,
int
padding
,
int
stride
)
{
int
PoolOutputSize
(
int
input_size
,
int
filter_size
,
int
padding
,
int
stride
)
{
int
output_size
=
(
input_size
-
filter_size
+
2
*
padding
)
/
stride
+
1
;
int
output_size
=
(
input_size
-
filter_size
+
2
*
padding
)
/
stride
+
1
;
PADDLE_ENFORCE
(
output_size
>
0
,
"Due to the settings of padding(%d), filter_size(%d) and "
"stride(%d), the output size is less than 0, please check "
"again. Input_size:%d"
,
padding
,
filter_size
,
stride
,
input_size
);
return
output_size
;
return
output_size
;
}
}
...
...
python/paddle/fluid/tests/unittests/test_conv2d_op.py
浏览文件 @
cf883d9c
...
@@ -210,6 +210,19 @@ class TestWithDilation(TestConv2dOp):
...
@@ -210,6 +210,19 @@ class TestWithDilation(TestConv2dOp):
self
.
groups
=
3
self
.
groups
=
3
class
TestWithInput1x1Filter1x1
(
TestConv2dOp
):
def
init_test_case
(
self
):
self
.
pad
=
[
0
,
0
]
self
.
stride
=
[
1
,
1
]
self
.
input_size
=
[
2
,
3
,
1
,
1
]
# NCHW
assert
np
.
mod
(
self
.
input_size
[
1
],
self
.
groups
)
==
0
f_c
=
self
.
input_size
[
1
]
/
self
.
groups
self
.
filter_size
=
[
6
,
f_c
,
1
,
1
]
def
init_group
(
self
):
self
.
groups
=
3
#----------------Conv2dCUDNN----------------
#----------------Conv2dCUDNN----------------
class
TestCUDNN
(
TestConv2dOp
):
class
TestCUDNN
(
TestConv2dOp
):
def
init_op_type
(
self
):
def
init_op_type
(
self
):
...
@@ -241,6 +254,12 @@ class TestCUDNNWith1x1(TestWith1x1):
...
@@ -241,6 +254,12 @@ class TestCUDNNWith1x1(TestWith1x1):
self
.
op_type
=
"conv2d"
self
.
op_type
=
"conv2d"
class
TestCUDNNWithInput1x1Filter1x1
(
TestWithInput1x1Filter1x1
):
def
init_op_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"conv2d"
class
TestDepthwiseConv
(
TestConv2dOp
):
class
TestDepthwiseConv
(
TestConv2dOp
):
def
init_test_case
(
self
):
def
init_test_case
(
self
):
self
.
pad
=
[
1
,
1
]
self
.
pad
=
[
1
,
1
]
...
@@ -265,7 +284,8 @@ class TestDepthwiseConv2(TestConv2dOp):
...
@@ -265,7 +284,8 @@ class TestDepthwiseConv2(TestConv2dOp):
self
.
op_type
=
"depthwise_conv2d"
self
.
op_type
=
"depthwise_conv2d"
# cudnn v5 does not support dilation conv.
# Please Don't remove the following code.
# Currently, CI use cudnn V5.0 which not support dilation conv.
# class TestCUDNNWithDilation(TestWithDilation):
# class TestCUDNNWithDilation(TestWithDilation):
# def init_op_type(self):
# def init_op_type(self):
# self.op_type = "conv_cudnn"
# self.op_type = "conv_cudnn"
...
...
python/paddle/fluid/tests/unittests/test_conv2d_transpose_op.py
浏览文件 @
cf883d9c
...
@@ -200,7 +200,8 @@ class TestCUDNNWithStride(TestWithStride):
...
@@ -200,7 +200,8 @@ class TestCUDNNWithStride(TestWithStride):
self
.
op_type
=
"conv2d_transpose"
self
.
op_type
=
"conv2d_transpose"
# #cudnn v5 does not support dilation conv.
# Please Don't remove the following code.
# Currently, CI use cudnn V5.0 which not support dilation conv.
# class TestCUDNNWithDilation(TestWithDilation):
# class TestCUDNNWithDilation(TestWithDilation):
# def init_test_case(self):
# def init_test_case(self):
# self.pad = [1, 1]
# self.pad = [1, 1]
...
...
python/paddle/fluid/tests/unittests/test_conv3d_op.py
浏览文件 @
cf883d9c
...
@@ -200,6 +200,22 @@ class TestWith1x1(TestConv3dOp):
...
@@ -200,6 +200,22 @@ class TestWith1x1(TestConv3dOp):
self
.
groups
=
3
self
.
groups
=
3
class
TestWithInput1x1Filter1x1
(
TestConv3dOp
):
def
init_test_case
(
self
):
self
.
pad
=
[
0
,
0
,
0
]
self
.
stride
=
[
1
,
1
,
1
]
self
.
input_size
=
[
2
,
3
,
1
,
1
,
1
]
# NCHW
assert
np
.
mod
(
self
.
input_size
[
1
],
self
.
groups
)
==
0
f_c
=
self
.
input_size
[
1
]
/
self
.
groups
self
.
filter_size
=
[
6
,
f_c
,
1
,
1
,
1
]
def
init_dilation
(
self
):
self
.
dilations
=
[
1
,
1
,
1
]
def
init_group
(
self
):
self
.
groups
=
3
class
TestWithDilation
(
TestConv3dOp
):
class
TestWithDilation
(
TestConv3dOp
):
def
init_test_case
(
self
):
def
init_test_case
(
self
):
self
.
pad
=
[
0
,
0
,
0
]
self
.
pad
=
[
0
,
0
,
0
]
...
@@ -240,6 +256,12 @@ class TestWith1x1CUDNN(TestWith1x1):
...
@@ -240,6 +256,12 @@ class TestWith1x1CUDNN(TestWith1x1):
self
.
op_type
=
"conv3d"
self
.
op_type
=
"conv3d"
class
TestWithInput1x1Filter1x1CUDNN
(
TestWithInput1x1Filter1x1
):
def
init_op_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"conv3d"
# FIXME(typhoonzero): find a way to determine if
# FIXME(typhoonzero): find a way to determine if
# using cudnn > 6 in python
# using cudnn > 6 in python
# class TestWithDilationCUDNN(TestWithDilation):
# class TestWithDilationCUDNN(TestWithDilation):
...
...
python/paddle/fluid/tests/unittests/test_conv3d_transpose_op.py
浏览文件 @
cf883d9c
...
@@ -207,7 +207,8 @@ class TestCUDNNWithStride(TestWithStride):
...
@@ -207,7 +207,8 @@ class TestCUDNNWithStride(TestWithStride):
self
.
op_type
=
"conv3d_transpose"
self
.
op_type
=
"conv3d_transpose"
# #cudnn v5 does not support dilation conv.
# Please Don't remove the following code.
# Currently, CI use cudnn V5.0 which not support dilation conv.
# class TestCUDNNWithDilation(TestWithDilation):
# class TestCUDNNWithDilation(TestWithDilation):
# def init_test_case(self):
# def init_test_case(self):
# self.pad = [1, 1, 1]
# self.pad = [1, 1, 1]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录