Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
b8d2a021
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看板
未验证
提交
b8d2a021
编写于
10月 10, 2020
作者:
Q
Qi Li
提交者:
GitHub
10月 10, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix ut error of test_recognize_digits, test=develop (#27791)
上级
c4b1faa4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
32 deletion
+24
-32
paddle/fluid/train/CMakeLists.txt
paddle/fluid/train/CMakeLists.txt
+16
-27
paddle/fluid/train/test_train_recognize_digits.cc
paddle/fluid/train/test_train_recognize_digits.cc
+8
-5
未找到文件。
paddle/fluid/train/CMakeLists.txt
浏览文件 @
b8d2a021
...
...
@@ -4,37 +4,26 @@ function(train_test TARGET_NAME)
set
(
multiValueArgs ARGS
)
cmake_parse_arguments
(
train_test
"
${
options
}
"
"
${
oneValueArgs
}
"
"
${
multiValueArgs
}
"
${
ARGN
}
)
set
(
arg_list
""
)
if
(
train_test_ARGS
)
foreach
(
arg
${
train_test_ARGS
}
)
list
(
APPEND arg_list
"_
${
arg
}
"
)
endforeach
(
)
if
(
NOT APPLE AND NOT WIN32
)
cc_test
(
test_train_
${
TARGET_NAME
}
SRCS test_train_
${
TARGET_NAME
}
.cc
DEPS paddle_fluid_shared
ARGS --dirname=
${
PYTHON_TESTS_DIR
}
/book/
)
else
()
list
(
APPEND arg_list
"_"
)
cc_test
(
test_train_
${
TARGET_NAME
}${
arg
}
SRCS test_train_
${
TARGET_NAME
}
.cc
DEPS paddle_fluid_api
ARGS --dirname=
${
PYTHON_TESTS_DIR
}
/book/
)
endif
()
set_tests_properties
(
test_train_
${
TARGET_NAME
}
PROPERTIES FIXTURES_REQUIRED test_
${
TARGET_NAME
}
_infer_model
)
if
(
NOT WIN32 AND NOT APPLE
)
set_tests_properties
(
test_train_
${
TARGET_NAME
}
PROPERTIES TIMEOUT 150
)
endif
()
foreach
(
arg
${
arg_list
}
)
string
(
REGEX REPLACE
"^_$"
""
arg
"
${
arg
}
"
)
if
(
NOT APPLE AND NOT WIN32
)
cc_test
(
test_train_
${
TARGET_NAME
}${
arg
}
SRCS test_train_
${
TARGET_NAME
}
.cc
DEPS paddle_fluid_shared
ARGS --dirname=
${
PYTHON_TESTS_DIR
}
/book/
${
TARGET_NAME
}${
arg
}
.train.model/
)
else
()
cc_test
(
test_train_
${
TARGET_NAME
}${
arg
}
SRCS test_train_
${
TARGET_NAME
}
.cc
DEPS paddle_fluid_api
ARGS --dirname=
${
PYTHON_TESTS_DIR
}
/book/
${
TARGET_NAME
}${
arg
}
.train.model/
)
endif
()
set_tests_properties
(
test_train_
${
TARGET_NAME
}${
arg
}
PROPERTIES FIXTURES_REQUIRED test_
${
TARGET_NAME
}
_infer_model
)
if
(
NOT WIN32 AND NOT APPLE
)
set_tests_properties
(
test_train_
${
TARGET_NAME
}${
arg
}
PROPERTIES TIMEOUT 150
)
endif
()
endforeach
()
endfunction
(
train_test
)
if
(
WITH_TESTING
)
train_test
(
recognize_digits
ARGS mlp conv
)
train_test
(
recognize_digits
)
endif
()
paddle/fluid/train/test_train_recognize_digits.cc
浏览文件 @
b8d2a021
...
...
@@ -32,16 +32,15 @@ DEFINE_string(dirname, "", "Directory of the train model.");
namespace
paddle
{
void
Train
()
{
CHECK
(
!
FLAGS_dirname
.
empty
());
void
Train
(
std
::
string
model_dir
)
{
framework
::
InitDevices
(
false
);
const
auto
cpu_place
=
platform
::
CPUPlace
();
framework
::
Executor
executor
(
cpu_place
);
framework
::
Scope
scope
;
auto
train_program
=
inference
::
Load
(
&
executor
,
&
scope
,
FLAGS_dirname
+
"__model_combined__.main_program"
,
FLAGS_dirname
+
"__params_combined__"
);
&
executor
,
&
scope
,
model_dir
+
"__model_combined__.main_program"
,
model_dir
+
"__params_combined__"
);
std
::
string
loss_name
=
""
;
for
(
auto
op_desc
:
train_program
->
Block
(
0
).
AllOps
())
{
...
...
@@ -87,6 +86,10 @@ void Train() {
EXPECT_LT
(
last_loss
,
first_loss
);
}
TEST
(
train
,
recognize_digits
)
{
Train
();
}
TEST
(
train
,
recognize_digits
)
{
CHECK
(
!
FLAGS_dirname
.
empty
());
Train
(
FLAGS_dirname
+
"recognize_digits_mlp.train.model/"
);
Train
(
FLAGS_dirname
+
"recognize_digits_conv.train.model/"
);
}
}
// namespace paddle
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录