Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
PaddleRec
提交
ef5c2be4
P
PaddleRec
项目概览
BaiXuePrincess
/
PaddleRec
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleRec
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleRec
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ef5c2be4
编写于
8月 16, 2019
作者:
R
rensilin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update_test_create_pregrams
Change-Id: Ibd81678790415b2b756a8a1b8cce04369e6e6947
上级
31555637
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
15 deletion
+32
-15
BCLOUD
BCLOUD
+3
-3
paddle/fluid/train/custom_trainer/feed/dataset/data_reader.cc
...le/fluid/train/custom_trainer/feed/dataset/data_reader.cc
+0
-1
paddle/fluid/train/custom_trainer/feed/unit_test/test_create_programs.cc
...ain/custom_trainer/feed/unit_test/test_create_programs.cc
+29
-11
未找到文件。
BCLOUD
浏览文件 @
ef5c2be4
...
...
@@ -101,11 +101,11 @@ application_args = [
Libs(module='baidu/third-party/openmpi', libs=['libmpi.so', 'libmpi_cxx.so', 'libopen-pal.so', 'libopen-rte.so']),
]
StaticLibrary("feed_trainer", Sources(custom_trainer_src), application_args)
StaticLibrary("feed_trainer", Sources(custom_trainer_src),
*
application_args)
Application('feed_trainer', Sources('paddle/fluid/train/custom_trainer/feed/main.cc'), WholeArchives("$OUT/lib/libfeed_trainer.a"), application_args)
Application('feed_trainer', Sources('paddle/fluid/train/custom_trainer/feed/main.cc'), WholeArchives("$OUT/lib/libfeed_trainer.a"),
*
application_args)
#feed unit test
# bug: shared librarys can not be found when run on server
UTApplication('unit_test', UTOnServer(False), Sources(UT_FILE('main.cc'), GLOB(UT_FILE('test_*.cc'))), WholeArchives("$OUT/lib/libfeed_trainer.a"), application_args)
UTApplication('unit_test', UTOnServer(False), Sources(UT_FILE('main.cc'), GLOB(UT_FILE('test_*.cc'))), WholeArchives("$OUT/lib/libfeed_trainer.a"),
*
application_args)
paddle/fluid/train/custom_trainer/feed/dataset/data_reader.cc
浏览文件 @
ef5c2be4
...
...
@@ -131,7 +131,6 @@ public:
return
read_all
(
file_list
,
data_channel
);
}
virtual
int
read_all
(
const
std
::
vector
<
std
::
string
>&
file_list
,
::
paddle
::
framework
::
Channel
<
DataItem
>
data_channel
)
{
DataItem
data_item
;
const
int
file_list_size
=
file_list
.
size
();
std
::
atomic
<
bool
>
is_failed
(
false
);
...
...
paddle/fluid/train/custom_trainer/feed/unit_test/test_create_programs.cc
浏览文件 @
ef5c2be4
...
...
@@ -77,21 +77,35 @@ TEST_F(CreateProgramsTest, example_network) {
std
::
string
input_name
=
"cvm_input"
;
ASSERT_TRUE
(
model_desc
[
"inputs"
]);
ASSERT_TRUE
(
model_desc
[
"inputs"
][
input_name
]);
ASSERT_TRUE
(
model_desc
[
"loss_name"
]);
ASSERT_TRUE
(
model_desc
[
"label_name"
]);
ASSERT_TRUE
(
model_desc
[
"ctr_output_name"
]);
auto
loss_name
=
model_desc
[
"loss_name"
].
as
<
std
::
string
>
();
auto
label_name
=
model_desc
[
"label_name"
].
as
<
std
::
string
>
();
auto
ctr_output_name
=
model_desc
[
"ctr_output_name"
].
as
<
std
::
string
>
();
std
::
vector
<
int
>
input_shape
=
model_desc
[
"inputs"
][
input_name
].
as
<
std
::
vector
<
int
>>
(
std
::
vector
<
int
>
());
ASSERT_EQ
(
1
,
model_desc
[
"inputs"
].
size
());
ASSERT_TRUE
(
model_desc
[
"inputs"
][
0
][
"name"
]);
ASSERT_TRUE
(
model_desc
[
"inputs"
][
0
][
"shape"
]);
ASSERT_EQ
(
input_name
,
model_desc
[
"inputs"
][
0
][
"name"
].
as
<
std
::
string
>
());
std
::
vector
<
int
>
input_shape
=
model_desc
[
"inputs"
][
0
][
"shape"
].
as
<
std
::
vector
<
int
>>
(
std
::
vector
<
int
>
());
ASSERT_EQ
(
2
,
input_shape
.
size
());
ASSERT_EQ
(
-
1
,
input_shape
[
0
]);
ASSERT_EQ
(
4488
,
input_shape
[
1
]);
ASSERT_TRUE
(
model_desc
[
"loss_all"
]);
auto
loss_all_name
=
model_desc
[
"loss_all"
].
as
<
std
::
string
>
();
ASSERT_TRUE
(
model_desc
[
"outputs"
]);
ASSERT_EQ
(
1
,
model_desc
[
"outputs"
].
size
());
ASSERT_TRUE
(
model_desc
[
"outputs"
][
0
][
"name"
]);
ASSERT_TRUE
(
model_desc
[
"outputs"
][
0
][
"shape"
]);
ASSERT_TRUE
(
model_desc
[
"outputs"
][
0
][
"label_name"
]);
ASSERT_TRUE
(
model_desc
[
"outputs"
][
0
][
"loss_name"
]);
auto
ctr_output_label_name
=
model_desc
[
"outputs"
][
0
][
"label_name"
].
as
<
std
::
string
>
();
auto
ctr_output_loss_name
=
model_desc
[
"outputs"
][
0
][
"loss_name"
].
as
<
std
::
string
>
();
auto
ctr_output_name
=
model_desc
[
"outputs"
][
0
][
"name"
].
as
<
std
::
string
>
();
std
::
vector
<
int
>
output_shape
=
model_desc
[
"outputs"
][
0
][
"shape"
].
as
<
std
::
vector
<
int
>>
(
std
::
vector
<
int
>
());
ASSERT_EQ
(
2
,
output_shape
.
size
());
ASSERT_EQ
(
-
1
,
output_shape
[
0
]);
ASSERT_EQ
(
1
,
output_shape
[
1
]);
auto
input_var
=
executor
->
mutable_var
<::
paddle
::
framework
::
LoDTensor
>
(
input_name
);
auto
label_var
=
executor
->
mutable_var
<::
paddle
::
framework
::
LoDTensor
>
(
label_name
);
auto
label_var
=
executor
->
mutable_var
<::
paddle
::
framework
::
LoDTensor
>
(
ctr_output_
label_name
);
ASSERT_NE
(
nullptr
,
input_var
);
ASSERT_NE
(
nullptr
,
label_var
);
...
...
@@ -109,14 +123,18 @@ TEST_F(CreateProgramsTest, example_network) {
ASSERT_EQ
(
0
,
executor
->
run
());
auto
loss_var
=
executor
->
var
<::
paddle
::
framework
::
LoDTensor
>
(
loss_name
);
auto
loss_var
=
executor
->
var
<::
paddle
::
framework
::
LoDTensor
>
(
ctr_output_
loss_name
);
auto
loss
=
loss_var
.
data
<
float
>
()[
0
];
auto
loss_all_var
=
executor
->
var
<::
paddle
::
framework
::
LoDTensor
>
(
loss_all_name
);
auto
loss_all
=
loss_all_var
.
data
<
float
>
()[
0
];
auto
ctr_output_var
=
executor
->
var
<::
paddle
::
framework
::
LoDTensor
>
(
ctr_output_name
);
auto
ctr_output
=
ctr_output_var
.
data
<
float
>
()[
0
];
std
::
cout
<<
"loss: "
<<
loss
<<
std
::
endl
;
std
::
cout
<<
"ctr_output: "
<<
ctr_output
<<
std
::
endl
;
ASSERT_NEAR
(
loss
,
loss_all
,
1e-9
);
}
}
// namespace feed
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录