Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
c30b6983
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c30b6983
编写于
1月 28, 2019
作者:
H
hjchen2
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update conv unit test
上级
6d9517b1
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
62 addition
and
20 deletion
+62
-20
test/operators/test_conv_op.cpp
test/operators/test_conv_op.cpp
+62
-20
未找到文件。
test/operators/test_conv_op.cpp
浏览文件 @
c30b6983
...
...
@@ -12,6 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include <iostream>
#include "../test_helper.h"
#include "../test_include.h"
#include "operators/conv_op.h"
...
...
@@ -209,10 +210,10 @@ int TestConvOp(int in_channels, int in_height, int in_width, int out_channels,
// PADDLE_MOBILE_ENFORCE(std::abs(gap / (output_data[i] + 1e-5)) < 1e-3,
// "output[%d] = %d, output_cmp[%d] = %d", i,
// output_data[i], i, output_cmp_data[i]);
if
(
std
::
abs
(
gap
/
(
output_data
[
i
]
+
1e-5
))
>
1e-3
)
{
LOG
(
kLOG_INFO
)
<<
"output_data["
<<
i
<<
"] = "
<<
output_data
[
i
]
<<
", output_cmp_data["
<<
i
<<
"] = "
<<
output_cmp_data
[
i
]
;
if
(
gap
>
1e-2
&&
std
::
abs
(
gap
/
(
output_data
[
i
]
+
1e-5
))
>
1e-3
)
{
std
::
cerr
<<
"output_data["
<<
i
<<
"] = "
<<
output_data
[
i
]
<<
", output_cmp_data["
<<
i
<<
"] = "
<<
output_cmp_data
[
i
]
<<
std
::
endl
;
exit
(
1
);
}
}
...
...
@@ -224,73 +225,114 @@ int TestConvOp(int in_channels, int in_height, int in_width, int out_channels,
int
TestAll
(
const
int
in_channels
,
const
int
in_height
,
const
int
in_width
,
const
int
out_channels
,
const
int
groups
)
{
std
::
cerr
<<
"in_channels="
<<
in_channels
<<
", in_height="
<<
in_height
<<
", in_width="
<<
in_width
<<
", out_channels="
<<
out_channels
<<
", groups="
<<
groups
<<
std
::
endl
;
// kernel = 3, pad = 0, stride = 1
LOG
(
paddle_mobile
::
kLOG_INFO
)
<<
"float, kernel=3, pad=0, stride=1"
;
std
::
cerr
<<
"float, kernel=3, pad=0, stride=1"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
float
,
float
,
3
,
0
,
1
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 3, pad = 1, stride = 1
std
::
cerr
<<
"float, kernel=3, pad=1, stride=1"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
float
,
float
,
3
,
1
,
1
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 3, pad = 2, stride = 1
std
::
cerr
<<
"float, kernel=3, pad=2, stride=1"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
float
,
float
,
3
,
2
,
1
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 3, pad = 5, stride = 1
std
::
cerr
<<
"float, kernel=3, pad=5, stride=1"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
float
,
float
,
3
,
5
,
1
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 3, pad = 0, stride = 2
std
::
cerr
<<
"float, kernel=3, pad=0, stride=2"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
float
,
float
,
3
,
0
,
2
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 3, pad = 1, stride = 2
std
::
cerr
<<
"float, kernel=3, pad=1, stride=2"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
float
,
float
,
3
,
1
,
2
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 3, pad = 2, stride = 2
std
::
cerr
<<
"float, kernel=3, pad=2, stride=2"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
float
,
float
,
3
,
2
,
2
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 3, pad = 5, stride = 2
std
::
cerr
<<
"float, kernel=3, pad=5, stride=2"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
float
,
float
,
3
,
5
,
2
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
#ifndef __aarch64__
// kernel = 3, pad = 0, stride = 1
std
::
cerr
<<
"int8, kernel=3, pad=0, stride=1"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
int8_t
,
int32_t
,
3
,
0
,
1
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 3, pad = 1, stride = 1
LOG
(
paddle_mobile
::
kLOG_INFO
)
<<
"float, kernel=3, pad=1, stride=1"
;
std
::
cerr
<<
"int8, kernel=3, pad=1, stride=1"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
int8_t
,
int32_t
,
3
,
1
,
1
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 3, pad = 2, stride = 1
LOG
(
paddle_mobile
::
kLOG_INFO
)
<<
"float, kernel=3, pad=2, stride=1"
;
std
::
cerr
<<
"int8, kernel=3, pad=2, stride=1"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
int8_t
,
int32_t
,
3
,
2
,
1
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 3, pad = 5, stride = 1
LOG
(
paddle_mobile
::
kLOG_INFO
)
<<
"float, kernel=3, pad=5, stride=1"
;
std
::
cerr
<<
"int8, kernel=3, pad=5, stride=1"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
int8_t
,
int32_t
,
3
,
5
,
1
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 3, pad = 0, stride = 2
LOG
(
paddle_mobile
::
kLOG_INFO
)
<<
"float, kernel=3, pad=0, stride=2"
;
std
::
cerr
<<
"int8, kernel=3, pad=0, stride=2"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
int8_t
,
int32_t
,
3
,
0
,
2
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 3, pad = 1, stride = 2
LOG
(
paddle_mobile
::
kLOG_INFO
)
<<
"float, kernel=3, pad=1, stride=2"
;
std
::
cerr
<<
"int8, kernel=3, pad=1, stride=2"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
int8_t
,
int32_t
,
3
,
1
,
2
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 3, pad = 2, stride = 2
LOG
(
paddle_mobile
::
kLOG_INFO
)
<<
"float, kernel=3, pad=2, stride=2"
;
std
::
cerr
<<
"int8, kernel=3, pad=2, stride=2"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
int8_t
,
int32_t
,
3
,
2
,
2
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 3, pad = 5, stride = 2
LOG
(
paddle_mobile
::
kLOG_INFO
)
<<
"float, kernel=3, pad=5, stride=2"
;
std
::
cerr
<<
"int8, kernel=3, pad=5, stride=2"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
int8_t
,
int32_t
,
3
,
5
,
2
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
#endif // __aarch64__
// kernel = 5, pad = 0, stride = 1
LOG
(
paddle_mobile
::
kLOG_INFO
)
<<
"float, kernel=5, pad=0, stride=1"
;
std
::
cerr
<<
"float, kernel=5, pad=0, stride=1"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
float
,
float
,
5
,
0
,
1
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 5, pad = 1, stride = 1
LOG
(
paddle_mobile
::
kLOG_INFO
)
<<
"float, kernel=5, pad=1, stride=1"
;
std
::
cerr
<<
"float, kernel=5, pad=1, stride=1"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
float
,
float
,
5
,
1
,
1
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 5, pad = 2, stride = 1
LOG
(
paddle_mobile
::
kLOG_INFO
)
<<
"float, kernel=5, pad=2, stride=1"
;
std
::
cerr
<<
"float, kernel=5, pad=2, stride=1"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
float
,
float
,
5
,
2
,
1
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 5, pad = 5, stride = 1
LOG
(
paddle_mobile
::
kLOG_INFO
)
<<
"float, kernel=5, pad=5, stride=1"
;
std
::
cerr
<<
"float, kernel=5, pad=5, stride=1"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
float
,
float
,
5
,
5
,
1
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
#ifndef __aarch64__
// kernel = 5, pad = 0, stride = 1
LOG
(
paddle_mobile
::
kLOG_INFO
)
<<
"int8, kernel=5, pad=0, stride=1"
;
std
::
cerr
<<
"int8, kernel=5, pad=0, stride=1"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
int8_t
,
int32_t
,
5
,
0
,
1
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 5, pad = 1, stride = 1
LOG
(
paddle_mobile
::
kLOG_INFO
)
<<
"int8, kernel=5, pad=1, stride=1"
;
std
::
cerr
<<
"int8, kernel=5, pad=1, stride=1"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
int8_t
,
int32_t
,
5
,
1
,
1
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 5, pad = 2, stride = 1
LOG
(
paddle_mobile
::
kLOG_INFO
)
<<
"int8, kernel=5, pad=2, stride=1"
;
std
::
cerr
<<
"int8, kernel=5, pad=2, stride=1"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
int8_t
,
int32_t
,
5
,
2
,
1
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
// kernel = 5, pad = 5, stride = 1
LOG
(
paddle_mobile
::
kLOG_INFO
)
<<
"int8, kernel=5, pad=5, stride=1"
;
std
::
cerr
<<
"int8, kernel=5, pad=5, stride=1"
<<
std
::
endl
;
paddle_mobile
::
TestConvOp
<
int8_t
,
int32_t
,
5
,
5
,
1
>
(
in_channels
,
in_height
,
in_width
,
out_channels
,
groups
);
#endif // __aarch64__
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录