Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
bd77a425
P
Paddle
项目概览
机器未来
/
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看板
未验证
提交
bd77a425
编写于
9月 15, 2020
作者:
石
石晓伟
提交者:
GitHub
9月 15, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
error messages of inference/tests, test=develop (#27259)
上级
bd41c314
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
115 addition
and
48 deletion
+115
-48
paddle/fluid/inference/tests/api/analyzer_bert_tester.cc
paddle/fluid/inference/tests/api/analyzer_bert_tester.cc
+8
-2
paddle/fluid/inference/tests/api/analyzer_capi_pd_tensor_tester.cc
...uid/inference/tests/api/analyzer_capi_pd_tensor_tester.cc
+5
-3
paddle/fluid/inference/tests/api/analyzer_capi_tester.cc
paddle/fluid/inference/tests/api/analyzer_capi_tester.cc
+5
-5
paddle/fluid/inference/tests/api/analyzer_dam_tester.cc
paddle/fluid/inference/tests/api/analyzer_dam_tester.cc
+12
-4
paddle/fluid/inference/tests/api/analyzer_int8_object_detection_tester.cc
...erence/tests/api/analyzer_int8_object_detection_tester.cc
+6
-4
paddle/fluid/inference/tests/api/analyzer_lac_tester.cc
paddle/fluid/inference/tests/api/analyzer_lac_tester.cc
+11
-4
paddle/fluid/inference/tests/api/analyzer_ner_tester.cc
paddle/fluid/inference/tests/api/analyzer_ner_tester.cc
+9
-3
paddle/fluid/inference/tests/api/analyzer_pyramid_dnn_tester.cc
.../fluid/inference/tests/api/analyzer_pyramid_dnn_tester.cc
+9
-3
paddle/fluid/inference/tests/api/analyzer_rnn2_tester.cc
paddle/fluid/inference/tests/api/analyzer_rnn2_tester.cc
+9
-3
paddle/fluid/inference/tests/api/analyzer_seq_conv1_tester.cc
...le/fluid/inference/tests/api/analyzer_seq_conv1_tester.cc
+11
-4
paddle/fluid/inference/tests/api/analyzer_seq_pool1_tester.cc
...le/fluid/inference/tests/api/analyzer_seq_pool1_tester.cc
+17
-9
paddle/fluid/inference/tests/api/analyzer_text_classification_tester.cc
...nference/tests/api/analyzer_text_classification_tester.cc
+6
-2
paddle/fluid/inference/tests/api/analyzer_vis_tester.cc
paddle/fluid/inference/tests/api/analyzer_vis_tester.cc
+6
-2
paddle/fluid/inference/tests/test_helper.h
paddle/fluid/inference/tests/test_helper.h
+1
-0
未找到文件。
paddle/fluid/inference/tests/api/analyzer_bert_tester.cc
浏览文件 @
bd77a425
...
...
@@ -245,8 +245,14 @@ TEST(Analyzer_bert, transfer_scope_cache) {
// Since paddle::framework::global_transfer_scope_cache() and
// paddle::framework::global_transfer_data_cache() are thread_local,
// their pointer should be different among different thread id.
PADDLE_ENFORCE
(
global_transfer_scope_cache
.
size
(),
threads_num
);
PADDLE_ENFORCE
(
global_transfer_data_cache
.
size
(),
threads_num
);
PADDLE_ENFORCE_EQ
(
global_transfer_scope_cache
.
size
(),
threads_num
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of scope cache is not equal to thread number."
));
PADDLE_ENFORCE_EQ
(
global_transfer_data_cache
.
size
(),
threads_num
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of data cache is not equal to thread number."
));
}
}
// namespace inference
...
...
paddle/fluid/inference/tests/api/analyzer_capi_pd_tensor_tester.cc
浏览文件 @
bd77a425
...
...
@@ -69,11 +69,13 @@ void PD_run() {
PD_DeletePaddleTensor
(
input
);
int
size
;
const
int
*
out_shape
=
PD_GetPaddleTensorShape
(
out_data
,
&
size
);
CHECK
(
size
==
2
)
<<
"The Output shape's size is NOT match."
;
PADDLE_ENFORCE_EQ
(
size
,
2
,
paddle
::
platform
::
errors
::
InvalidArgument
(
"The Output shape's size is NOT match."
));
std
::
vector
<
int
>
ref_outshape_size
({
9
,
6
});
for
(
int
i
=
0
;
i
<
2
;
++
i
)
{
CHECK
(
out_shape
[
i
]
==
ref_outshape_size
[
i
])
<<
"The Output's shape is NOT match."
;
PADDLE_ENFORCE_EQ
(
out_shape
[
i
],
ref_outshape_size
[
i
],
paddle
::
platform
::
errors
::
InvalidArgument
(
"The Output shape's size is NOT match."
));
}
PD_DeletePaddleBuf
(
buf
);
}
...
...
paddle/fluid/inference/tests/api/analyzer_capi_tester.cc
浏览文件 @
bd77a425
...
...
@@ -36,9 +36,9 @@ void zero_copy_run() {
PD_SwitchIrDebug
(
config
,
true
);
PD_SetModel
(
config
,
prog_file
.
c_str
(),
params_file
.
c_str
());
bool
use_feed_fetch
=
PD_UseFeedFetchOpsEnabled
(
config
);
CHECK
(
!
use_feed_fetch
)
<<
"NO"
;
EXPECT_FALSE
(
use_feed_fetch
)
;
bool
specify_input_names
=
PD_SpecifyInputName
(
config
);
CHECK
(
specify_input_names
)
<<
"NO"
;
EXPECT_TRUE
(
specify_input_names
)
;
const
int
batch_size
=
1
;
const
int
channels
=
3
;
...
...
@@ -85,13 +85,13 @@ TEST(PD_AnalysisConfig, profile_mkldnn) {
PD_SwitchIrDebug
(
config
,
true
);
PD_EnableMKLDNN
(
config
);
bool
mkldnn_enable
=
PD_MkldnnEnabled
(
config
);
CHECK
(
mkldnn_enable
)
<<
"NO"
;
EXPECT_TRUE
(
mkldnn_enable
)
;
PD_EnableMkldnnQuantizer
(
config
);
bool
quantizer_enable
=
PD_MkldnnQuantizerEnabled
(
config
);
CHECK
(
quantizer_enable
)
<<
"NO"
;
EXPECT_TRUE
(
quantizer_enable
)
;
PD_EnableMkldnnBfloat16
(
config
);
bool
bfloat16_enable
=
PD_MkldnnBfloat16Enabled
(
config
);
CHECK
(
bfloat16_enable
)
<<
"NO"
;
EXPECT_TRUE
(
bfloat16_enable
)
;
PD_SetMkldnnCacheCapacity
(
config
,
0
);
PD_SetModel
(
config
,
prog_file
.
c_str
(),
params_file
.
c_str
());
PD_DeleteAnalysisConfig
(
config
);
...
...
paddle/fluid/inference/tests/api/analyzer_dam_tester.cc
浏览文件 @
bd77a425
...
...
@@ -126,7 +126,9 @@ void PrepareInputs(std::vector<PaddleTensor> *input_slots, DataRecord *data,
std
::
string
turn_mask_pre
=
"turn_mask_"
;
auto
one_batch
=
data
->
NextBatch
();
PADDLE_ENFORCE
(
!
one_batch
.
response
.
empty
());
PADDLE_ENFORCE
(
!
one_batch
.
response
.
empty
(),
paddle
::
platform
::
errors
::
Fatal
(
"The response of one batch is empty."
));
int
size
=
one_batch
.
response
[
0
].
size
();
CHECK_EQ
(
size
,
kMaxTurnLen
);
// turn tensor assignment
...
...
@@ -214,11 +216,17 @@ void profile(bool use_mkldnn = false) {
input_slots_all
,
&
outputs
,
FLAGS_num_threads
);
if
(
FLAGS_num_threads
==
1
&&
!
FLAGS_test_all_data
)
{
PADDLE_ENFORCE_GT
(
outputs
.
size
(),
0
);
PADDLE_ENFORCE_GT
(
outputs
.
size
(),
0
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of outputs should be greater than 0."
));
auto
output
=
outputs
.
back
();
PADDLE_ENFORCE_GT
(
output
.
size
(),
0
);
PADDLE_ENFORCE_GT
(
output
.
size
(),
0
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of output should be greater than 0."
));
size_t
size
=
GetSize
(
output
[
0
]);
PADDLE_ENFORCE_GT
(
size
,
0
);
PADDLE_ENFORCE_GT
(
size
,
0
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of output should be greater than 0."
));
float
*
result
=
static_cast
<
float
*>
(
output
[
0
].
data
.
data
());
for
(
size_t
i
=
0
;
i
<
size
;
i
++
)
{
EXPECT_NEAR
(
result
[
i
],
result_data
[
i
],
1e-3
);
...
...
paddle/fluid/inference/tests/api/analyzer_int8_object_detection_tester.cc
浏览文件 @
bd77a425
...
...
@@ -146,8 +146,9 @@ std::shared_ptr<std::vector<PaddleTensor>> GetWarmupData(
auto
iterations
=
test_data
.
size
();
PADDLE_ENFORCE_LE
(
static_cast
<
size_t
>
(
num_images
),
iterations
*
test_data_batch_size
,
"The requested quantization warmup data size "
+
std
::
to_string
(
num_images
)
+
" is bigger than all test data size."
);
paddle
::
platform
::
errors
::
Fatal
(
"The requested quantization warmup data size "
+
std
::
to_string
(
num_images
)
+
" is bigger than all test data size."
));
PaddleTensor
images
;
images
.
name
=
"image"
;
...
...
@@ -237,8 +238,9 @@ std::shared_ptr<std::vector<PaddleTensor>> GetWarmupData(
}
PADDLE_ENFORCE_EQ
(
static_cast
<
size_t
>
(
num_objects
),
static_cast
<
size_t
>
(
objects_accum
),
"The requested num of objects "
+
std
::
to_string
(
num_objects
)
+
" is the same as objects_accum."
);
paddle
::
platform
::
errors
::
Fatal
(
"The requested num of objects "
+
std
::
to_string
(
num_objects
)
+
" is the same as objects_accum."
));
auto
warmup_data
=
std
::
make_shared
<
std
::
vector
<
PaddleTensor
>>
(
4
);
(
*
warmup_data
)[
0
]
=
std
::
move
(
images
);
...
...
paddle/fluid/inference/tests/api/analyzer_lac_tester.cc
浏览文件 @
bd77a425
...
...
@@ -98,7 +98,9 @@ void GetOneBatch(std::vector<PaddleTensor> *input_slots, DataRecord *data,
input_tensor
.
name
=
"word"
;
input_tensor
.
dtype
=
PaddleDType
::
INT64
;
TensorAssignData
<
int64_t
>
(
&
input_tensor
,
{
one_batch
.
data
},
one_batch
.
lod
);
PADDLE_ENFORCE_EQ
(
batch_size
,
static_cast
<
int
>
(
one_batch
.
lod
.
size
()
-
1
));
PADDLE_ENFORCE_EQ
(
batch_size
,
static_cast
<
int
>
(
one_batch
.
lod
.
size
()
-
1
),
paddle
::
platform
::
errors
::
Fatal
(
"The lod size of one batch is invaild."
));
input_slots
->
assign
({
input_tensor
});
}
...
...
@@ -137,12 +139,17 @@ TEST(Analyzer_LAC, profile) {
24
,
25
,
25
,
25
,
38
,
30
,
31
,
14
,
15
,
44
,
24
,
25
,
25
,
25
,
25
,
25
,
44
,
24
,
25
,
25
,
25
,
36
,
42
,
43
,
44
,
14
,
15
,
44
,
14
,
15
,
44
,
14
,
15
,
44
,
38
,
39
,
14
,
15
,
44
,
22
,
23
,
23
,
23
,
23
,
23
,
23
,
23
};
PADDLE_ENFORCE_GT
(
outputs
.
size
(),
0
);
PADDLE_ENFORCE_GT
(
outputs
.
size
(),
0
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of output should be greater than 0."
));
auto
output
=
outputs
.
back
();
PADDLE_ENFORCE_EQ
(
output
.
size
(),
1UL
);
PADDLE_ENFORCE_EQ
(
output
.
size
(),
1UL
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of output should be equal to 1."
));
size_t
size
=
GetSize
(
output
[
0
]);
size_t
batch1_size
=
sizeof
(
lac_ref_data
)
/
sizeof
(
int64_t
);
PADDLE_ENFORCE_GE
(
size
,
batch1_size
);
PADDLE_ENFORCE_GE
(
size
,
batch1_size
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of batch is invaild."
));
int64_t
*
pdata
=
static_cast
<
int64_t
*>
(
output
[
0
].
data
.
data
());
for
(
size_t
i
=
0
;
i
<
batch1_size
;
++
i
)
{
EXPECT_EQ
(
pdata
[
i
],
lac_ref_data
[
i
]);
...
...
paddle/fluid/inference/tests/api/analyzer_ner_tester.cc
浏览文件 @
bd77a425
...
...
@@ -117,11 +117,17 @@ void profile(bool memory_load = false) {
// the first inference result
const
int
chinese_ner_result_data
[]
=
{
30
,
45
,
41
,
48
,
17
,
26
,
48
,
39
,
38
,
16
,
25
};
PADDLE_ENFORCE_GT
(
outputs
.
size
(),
0
);
PADDLE_ENFORCE_GT
(
outputs
.
size
(),
0
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of output should be greater than 0."
));
auto
output
=
outputs
.
back
();
PADDLE_ENFORCE_EQ
(
output
.
size
(),
1UL
);
PADDLE_ENFORCE_EQ
(
output
.
size
(),
1UL
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of output should be equal to 1."
));
size_t
size
=
GetSize
(
output
[
0
]);
PADDLE_ENFORCE_GT
(
size
,
0
);
PADDLE_ENFORCE_GT
(
size
,
0
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of output should be greater than 0."
));
int64_t
*
result
=
static_cast
<
int64_t
*>
(
output
[
0
].
data
.
data
());
for
(
size_t
i
=
0
;
i
<
std
::
min
<
size_t
>
(
11
,
size
);
i
++
)
{
EXPECT_EQ
(
result
[
i
],
chinese_ner_result_data
[
i
]);
...
...
paddle/fluid/inference/tests/api/analyzer_pyramid_dnn_tester.cc
浏览文件 @
bd77a425
...
...
@@ -136,11 +136,17 @@ TEST(Analyzer_Pyramid_DNN, profile) {
input_slots_all
,
&
outputs
,
FLAGS_num_threads
);
if
(
FLAGS_num_threads
==
1
&&
!
FLAGS_test_all_data
&&
!
FLAGS_zero_copy
)
{
PADDLE_ENFORCE_GT
(
outputs
.
size
(),
0
);
PADDLE_ENFORCE_GT
(
outputs
.
size
(),
0
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of output should be greater than 0."
));
auto
output
=
outputs
.
back
();
PADDLE_ENFORCE_EQ
(
output
.
size
(),
1UL
);
PADDLE_ENFORCE_EQ
(
output
.
size
(),
1UL
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of output should be equal to 1."
));
size_t
size
=
GetSize
(
output
[
0
]);
PADDLE_ENFORCE_GT
(
size
,
0
);
PADDLE_ENFORCE_GT
(
size
,
0
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of output should be greater than 0."
));
float
*
result
=
static_cast
<
float
*>
(
output
[
0
].
data
.
data
());
// output is probability, which is in (0, 1).
for
(
size_t
i
=
0
;
i
<
size
;
i
++
)
{
...
...
paddle/fluid/inference/tests/api/analyzer_rnn2_tester.cc
浏览文件 @
bd77a425
...
...
@@ -135,11 +135,17 @@ TEST(Analyzer_rnn2, profile) {
if
(
FLAGS_num_threads
==
1
&&
!
FLAGS_test_all_data
)
{
// the first inference result
PADDLE_ENFORCE_GT
(
outputs
.
size
(),
0
);
PADDLE_ENFORCE_GT
(
outputs
.
size
(),
0
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of output should be greater than 0."
));
auto
output
=
outputs
.
back
();
PADDLE_ENFORCE_GT
(
output
.
size
(),
0
);
PADDLE_ENFORCE_GT
(
output
.
size
(),
0
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of output should be greater than 0."
));
size_t
size
=
GetSize
(
output
[
0
]);
PADDLE_ENFORCE_GT
(
size
,
0
);
PADDLE_ENFORCE_GT
(
size
,
0
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of output should be greater than 0."
));
float
*
result
=
static_cast
<
float
*>
(
output
[
0
].
data
.
data
());
for
(
size_t
i
=
0
;
i
<
size
;
i
++
)
{
EXPECT_NEAR
(
result
[
i
],
result_data
[
i
],
1e-3
);
...
...
paddle/fluid/inference/tests/api/analyzer_seq_conv1_tester.cc
浏览文件 @
bd77a425
...
...
@@ -47,7 +47,8 @@ struct DataRecord {
num_lines
++
;
std
::
vector
<
std
::
string
>
data
;
split
(
line
,
'\t'
,
&
data
);
PADDLE_ENFORCE
(
data
.
size
()
>=
4
);
PADDLE_ENFORCE_GT
(
data
.
size
(),
4
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of data is invaild."
));
// load title1 data
std
::
vector
<
int64_t
>
title1_data
;
split_to_int64
(
data
[
0
],
' '
,
&
title1_data
);
...
...
@@ -120,11 +121,17 @@ TEST(Analyzer_seq_conv1, profile) {
if
(
FLAGS_num_threads
==
1
&&
!
FLAGS_test_all_data
)
{
// the first inference result
PADDLE_ENFORCE_GT
(
outputs
.
size
(),
0
);
PADDLE_ENFORCE_GT
(
outputs
.
size
(),
0
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of output should be greater than 0."
));
auto
output
=
outputs
.
back
();
PADDLE_ENFORCE_EQ
(
output
.
size
(),
1UL
);
PADDLE_ENFORCE_EQ
(
output
.
size
(),
1UL
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of output should be equal to 0."
));
size_t
size
=
GetSize
(
output
[
0
]);
PADDLE_ENFORCE_GT
(
size
,
0
);
PADDLE_ENFORCE_GT
(
size
,
0
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of output should be greater than 0."
));
float
*
result
=
static_cast
<
float
*>
(
output
[
0
].
data
.
data
());
// output is probability, which is in (0, 1).
for
(
size_t
i
=
0
;
i
<
size
;
i
++
)
{
...
...
paddle/fluid/inference/tests/api/analyzer_seq_pool1_tester.cc
浏览文件 @
bd77a425
...
...
@@ -56,20 +56,26 @@ struct DataRecord {
std
::
vector
<
float
>
slot_data
;
split_to_float
(
data
[
1
],
' '
,
&
slot_data
);
std
::
string
name
=
data
[
0
];
PADDLE_ENFORCE_EQ
(
slot_data
.
size
()
%
11
,
0UL
,
"line %d, %s should be divisible"
,
num_lines
,
name
);
PADDLE_ENFORCE_EQ
(
slot_data
.
size
()
%
11
,
0UL
,
paddle
::
platform
::
errors
::
Fatal
(
"line %d, %s should be divisible"
,
num_lines
,
name
));
datasets
[
name
].
emplace_back
(
std
::
move
(
slot_data
));
}
num_samples
=
num_lines
/
num_slots
;
PADDLE_ENFORCE_EQ
(
num_samples
*
num_slots
,
static_cast
<
size_t
>
(
num_lines
),
"num samples should be divisible"
);
PADDLE_ENFORCE_GT
(
num_samples
,
0UL
);
PADDLE_ENFORCE_EQ
(
num_samples
*
num_slots
,
static_cast
<
size_t
>
(
num_lines
),
paddle
::
platform
::
errors
::
Fatal
(
"num samples should be divisible"
));
PADDLE_ENFORCE_GT
(
num_samples
,
0UL
,
paddle
::
platform
::
errors
::
Fatal
(
"The num of samples should be greater than 0."
));
}
void
Prepare
(
int
bs
)
{
for
(
auto
it
=
datasets
.
begin
();
it
!=
datasets
.
end
();
++
it
)
{
PADDLE_ENFORCE_EQ
(
it
->
second
.
size
(),
num_samples
,
"size of each slot should be equal"
);
PADDLE_ENFORCE_EQ
(
it
->
second
.
size
(),
num_samples
,
paddle
::
platform
::
errors
::
Fatal
(
"size of each slot should be equal"
));
}
size_t
num_batches
=
num_samples
/
bs
;
EXPECT_GT
(
num_batches
,
0UL
);
...
...
@@ -90,8 +96,10 @@ struct DataRecord {
std
::
copy
(
datas
[
id
].
begin
(),
datas
[
id
].
end
(),
std
::
back_inserter
(
slot
.
data
[
k
]));
size_t
len
=
datas
[
id
].
size
()
/
11
;
PADDLE_ENFORCE_EQ
(
len
*
11
,
datas
[
id
].
size
(),
"%s %d size should be divisible"
,
slot
.
name
,
id
);
PADDLE_ENFORCE_EQ
(
len
*
11
,
datas
[
id
].
size
(),
paddle
::
platform
::
errors
::
Fatal
(
"%s %d size should be divisible"
,
slot
.
name
,
id
));
lod
[
k
+
1
]
=
lod
[
k
]
+
len
;
}
slot
.
shape
.
assign
({
static_cast
<
int
>
(
lod
[
bs
]),
11
});
...
...
paddle/fluid/inference/tests/api/analyzer_text_classification_tester.cc
浏览文件 @
bd77a425
...
...
@@ -22,7 +22,9 @@ struct DataReader {
:
file
(
new
std
::
ifstream
(
path
))
{}
bool
NextBatch
(
std
::
vector
<
PaddleTensor
>
*
input
,
int
batch_size
)
{
PADDLE_ENFORCE_EQ
(
batch_size
,
1
);
PADDLE_ENFORCE_EQ
(
batch_size
,
1
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of batch should be equal to 1."
));
std
::
string
line
;
PaddleTensor
tensor
;
tensor
.
dtype
=
PaddleDType
::
INT64
;
...
...
@@ -81,7 +83,9 @@ TEST(Analyzer_Text_Classification, profile) {
if
(
FLAGS_num_threads
==
1
)
{
// Get output
PADDLE_ENFORCE_GT
(
outputs
.
size
(),
0
);
PADDLE_ENFORCE_GT
(
outputs
.
size
(),
0
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of output should be greater than 0."
));
LOG
(
INFO
)
<<
"get outputs "
<<
outputs
.
back
().
size
();
for
(
auto
&
output
:
outputs
.
back
())
{
LOG
(
INFO
)
<<
"output.shape: "
<<
to_string
(
output
.
shape
);
...
...
paddle/fluid/inference/tests/api/analyzer_vis_tester.cc
浏览文件 @
bd77a425
...
...
@@ -59,7 +59,9 @@ void SetConfig(AnalysisConfig *cfg) {
}
void
SetInput
(
std
::
vector
<
std
::
vector
<
PaddleTensor
>>
*
inputs
)
{
PADDLE_ENFORCE_EQ
(
FLAGS_test_all_data
,
0
,
"Only have single batch of data."
);
PADDLE_ENFORCE_EQ
(
FLAGS_test_all_data
,
0
,
paddle
::
platform
::
errors
::
Fatal
(
"Only have single batch of data."
));
std
::
string
line
;
std
::
ifstream
file
(
FLAGS_infer_data
);
std
::
getline
(
file
,
line
);
...
...
@@ -99,7 +101,9 @@ void profile(bool use_mkldnn = false) {
auto
refer
=
ProcessALine
(
line
);
file
.
close
();
PADDLE_ENFORCE_GT
(
outputs
.
size
(),
0
);
PADDLE_ENFORCE_GT
(
outputs
.
size
(),
0
,
paddle
::
platform
::
errors
::
Fatal
(
"The size of output should be greater than 0."
));
auto
&
output
=
outputs
.
back
().
front
();
size_t
numel
=
output
.
data
.
length
()
/
PaddleDtypeSize
(
output
.
dtype
);
CHECK_EQ
(
numel
,
refer
.
data
.
size
());
...
...
paddle/fluid/inference/tests/test_helper.h
浏览文件 @
bd77a425
...
...
@@ -21,6 +21,7 @@ limitations under the License. */
#include "paddle/fluid/framework/lod_tensor.h"
#include "paddle/fluid/inference/io.h"
#include "paddle/fluid/platform/errors.h"
#include "paddle/fluid/platform/port.h"
#include "paddle/fluid/platform/profiler.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录