Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
53c6890a
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
53c6890a
编写于
4月 03, 2019
作者:
L
luotao1
提交者:
Tao Luo
4月 04, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test_analyzer_int8 tests use default pass order
test=release/1.4
上级
ab6600e1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
22 deletion
+17
-22
paddle/fluid/inference/api/paddle_pass_builder.cc
paddle/fluid/inference/api/paddle_pass_builder.cc
+7
-5
paddle/fluid/inference/tests/api/analyzer_int8_image_classification_tester.cc
...ce/tests/api/analyzer_int8_image_classification_tester.cc
+4
-11
paddle/fluid/inference/tests/api/tester_helper.h
paddle/fluid/inference/tests/api/tester_helper.h
+6
-6
未找到文件。
paddle/fluid/inference/api/paddle_pass_builder.cc
浏览文件 @
53c6890a
...
@@ -86,7 +86,8 @@ const std::vector<std::string> kAnakinSubgraphPasses({
...
@@ -86,7 +86,8 @@ const std::vector<std::string> kAnakinSubgraphPasses({
GpuPassStrategy
::
GpuPassStrategy
()
:
PassStrategy
({})
{
GpuPassStrategy
::
GpuPassStrategy
()
:
PassStrategy
({})
{
passes_
.
assign
({
passes_
.
assign
({
"infer_clean_graph_pass"
,
//
"infer_clean_graph_pass"
,
//
"runtime_context_cache_pass"
,
//
// "identity_scale_op_clean_pass", //
// "identity_scale_op_clean_pass", //
"conv_affine_channel_fuse_pass"
,
//
"conv_affine_channel_fuse_pass"
,
//
"conv_eltwiseadd_affine_channel_fuse_pass"
,
//
"conv_eltwiseadd_affine_channel_fuse_pass"
,
//
...
@@ -96,7 +97,6 @@ GpuPassStrategy::GpuPassStrategy() : PassStrategy({}) {
...
@@ -96,7 +97,6 @@ GpuPassStrategy::GpuPassStrategy() : PassStrategy({}) {
"conv_elementwise_add_act_fuse_pass"
,
//
"conv_elementwise_add_act_fuse_pass"
,
//
"conv_elementwise_add2_act_fuse_pass"
,
//
"conv_elementwise_add2_act_fuse_pass"
,
//
"conv_elementwise_add_fuse_pass"
,
//
"conv_elementwise_add_fuse_pass"
,
//
"runtime_context_cache_pass"
,
//
#endif //
#endif //
"transpose_flatten_concat_fuse_pass"
,
"transpose_flatten_concat_fuse_pass"
,
});
});
...
@@ -116,7 +116,11 @@ CpuPassStrategy::CpuPassStrategy() : PassStrategy({}) {
...
@@ -116,7 +116,11 @@ CpuPassStrategy::CpuPassStrategy() : PassStrategy({}) {
// NOTE the large fusions should be located in the front, so that they will
// NOTE the large fusions should be located in the front, so that they will
// not be damaged by smaller ones.
// not be damaged by smaller ones.
passes_
.
assign
({
passes_
.
assign
({
"infer_clean_graph_pass"
,
//
"infer_clean_graph_pass"
,
//
// TODO(luotao): runtime_context_cache_pass should be located in the
// front, see https://github.com/PaddlePaddle/Paddle/issues/16609,
// will enhance this pass later.
"runtime_context_cache_pass"
,
//
"attention_lstm_fuse_pass"
,
//
"attention_lstm_fuse_pass"
,
//
"seqpool_concat_fuse_pass"
,
//
"seqpool_concat_fuse_pass"
,
//
"seqconv_eltadd_relu_fuse_pass"
,
//
"seqconv_eltadd_relu_fuse_pass"
,
//
...
@@ -132,8 +136,6 @@ CpuPassStrategy::CpuPassStrategy() : PassStrategy({}) {
...
@@ -132,8 +136,6 @@ CpuPassStrategy::CpuPassStrategy() : PassStrategy({}) {
"conv_bn_fuse_pass"
,
//
"conv_bn_fuse_pass"
,
//
"conv_eltwiseadd_bn_fuse_pass"
,
//
"conv_eltwiseadd_bn_fuse_pass"
,
//
"is_test_pass"
,
//
"is_test_pass"
,
//
"identity_scale_op_clean_pass"
,
//
"runtime_context_cache_pass"
,
//
});
});
use_gpu_
=
false
;
use_gpu_
=
false
;
}
}
...
...
paddle/fluid/inference/tests/api/analyzer_int8_image_classification_tester.cc
浏览文件 @
53c6890a
...
@@ -23,18 +23,11 @@ namespace analysis {
...
@@ -23,18 +23,11 @@ namespace analysis {
void
SetConfig
(
AnalysisConfig
*
cfg
)
{
void
SetConfig
(
AnalysisConfig
*
cfg
)
{
cfg
->
SetModel
(
FLAGS_infer_model
);
cfg
->
SetModel
(
FLAGS_infer_model
);
cfg
->
SetProgFile
(
"__model__"
);
cfg
->
DisableGpu
();
cfg
->
DisableGpu
();
cfg
->
SwitchIrOptim
();
cfg
->
SwitchIrOptim
();
cfg
->
SwitchSpecifyInputNames
(
false
);
cfg
->
SwitchSpecifyInputNames
();
cfg
->
SetCpuMathLibraryNumThreads
(
FLAGS_paddle_num_threads
);
cfg
->
SetCpuMathLibraryNumThreads
(
FLAGS_paddle_num_threads
);
cfg
->
EnableMKLDNN
();
cfg
->
EnableMKLDNN
();
cfg
->
pass_builder
()
->
SetPasses
(
{
"infer_clean_graph_pass"
,
"mkldnn_placement_pass"
,
"depthwise_conv_mkldnn_pass"
,
"conv_bn_fuse_pass"
,
"conv_eltwiseadd_bn_fuse_pass"
,
"conv_bias_mkldnn_fuse_pass"
,
"conv_elementwise_add_mkldnn_fuse_pass"
,
"conv_relu_mkldnn_fuse_pass"
,
"fc_fuse_pass"
,
"is_test_pass"
});
}
}
template
<
typename
T
>
template
<
typename
T
>
...
@@ -84,13 +77,13 @@ std::shared_ptr<std::vector<PaddleTensor>> GetWarmupData(
...
@@ -84,13 +77,13 @@ std::shared_ptr<std::vector<PaddleTensor>> GetWarmupData(
std
::
to_string
(
num_images
)
+
" is bigger than all test data size."
);
std
::
to_string
(
num_images
)
+
" is bigger than all test data size."
);
PaddleTensor
images
;
PaddleTensor
images
;
images
.
name
=
"i
nput
"
;
images
.
name
=
"i
mage
"
;
images
.
shape
=
{
num_images
,
3
,
224
,
224
};
images
.
shape
=
{
num_images
,
3
,
224
,
224
};
images
.
dtype
=
PaddleDType
::
FLOAT32
;
images
.
dtype
=
PaddleDType
::
FLOAT32
;
images
.
data
.
Resize
(
sizeof
(
float
)
*
num_images
*
3
*
224
*
224
);
images
.
data
.
Resize
(
sizeof
(
float
)
*
num_images
*
3
*
224
*
224
);
PaddleTensor
labels
;
PaddleTensor
labels
;
labels
.
name
=
"label
s
"
;
labels
.
name
=
"label"
;
labels
.
shape
=
{
num_images
,
1
};
labels
.
shape
=
{
num_images
,
1
};
labels
.
dtype
=
PaddleDType
::
INT64
;
labels
.
dtype
=
PaddleDType
::
INT64
;
labels
.
data
.
Resize
(
sizeof
(
int64_t
)
*
num_images
);
labels
.
data
.
Resize
(
sizeof
(
int64_t
)
*
num_images
);
...
@@ -132,7 +125,7 @@ void SetInput(std::vector<std::vector<PaddleTensor>> *inputs,
...
@@ -132,7 +125,7 @@ void SetInput(std::vector<std::vector<PaddleTensor>> *inputs,
images_offset_in_file
+
sizeof
(
float
)
*
total_images
*
3
*
224
*
224
;
images_offset_in_file
+
sizeof
(
float
)
*
total_images
*
3
*
224
*
224
;
TensorReader
<
float
>
image_reader
(
file
,
images_offset_in_file
,
TensorReader
<
float
>
image_reader
(
file
,
images_offset_in_file
,
image_batch_shape
,
"i
nput
"
);
image_batch_shape
,
"i
mage
"
);
TensorReader
<
int64_t
>
label_reader
(
file
,
labels_offset_in_file
,
TensorReader
<
int64_t
>
label_reader
(
file
,
labels_offset_in_file
,
label_batch_shape
,
"label"
);
label_batch_shape
,
"label"
);
...
...
paddle/fluid/inference/tests/api/tester_helper.h
浏览文件 @
53c6890a
...
@@ -316,7 +316,8 @@ void PredictionRun(PaddlePredictor *predictor,
...
@@ -316,7 +316,8 @@ void PredictionRun(PaddlePredictor *predictor,
int
num_threads
,
int
tid
)
{
int
num_threads
,
int
tid
)
{
int
num_times
=
FLAGS_repeat
;
int
num_times
=
FLAGS_repeat
;
int
iterations
=
inputs
.
size
();
// process the whole dataset ...
int
iterations
=
inputs
.
size
();
// process the whole dataset ...
if
(
FLAGS_iterations
>
0
&&
FLAGS_iterations
<
inputs
.
size
())
if
(
FLAGS_iterations
>
0
&&
FLAGS_iterations
<
static_cast
<
int64_t
>
(
inputs
.
size
()))
iterations
=
iterations
=
FLAGS_iterations
;
// ... unless the number of iterations is set
FLAGS_iterations
;
// ... unless the number of iterations is set
outputs
->
resize
(
iterations
);
outputs
->
resize
(
iterations
);
...
@@ -329,14 +330,14 @@ void PredictionRun(PaddlePredictor *predictor,
...
@@ -329,14 +330,14 @@ void PredictionRun(PaddlePredictor *predictor,
#endif
#endif
if
(
!
FLAGS_zero_copy
)
{
if
(
!
FLAGS_zero_copy
)
{
run_timer
.
tic
();
run_timer
.
tic
();
for
(
size_
t
i
=
0
;
i
<
iterations
;
i
++
)
{
for
(
in
t
i
=
0
;
i
<
iterations
;
i
++
)
{
for
(
int
j
=
0
;
j
<
num_times
;
j
++
)
{
for
(
int
j
=
0
;
j
<
num_times
;
j
++
)
{
predictor
->
Run
(
inputs
[
i
],
&
(
*
outputs
)[
i
],
FLAGS_batch_size
);
predictor
->
Run
(
inputs
[
i
],
&
(
*
outputs
)[
i
],
FLAGS_batch_size
);
}
}
}
}
elapsed_time
=
run_timer
.
toc
();
elapsed_time
=
run_timer
.
toc
();
}
else
{
}
else
{
for
(
size_
t
i
=
0
;
i
<
iterations
;
i
++
)
{
for
(
in
t
i
=
0
;
i
<
iterations
;
i
++
)
{
ConvertPaddleTensorToZeroCopyTensor
(
predictor
,
inputs
[
i
]);
ConvertPaddleTensorToZeroCopyTensor
(
predictor
,
inputs
[
i
]);
run_timer
.
tic
();
run_timer
.
tic
();
for
(
int
j
=
0
;
j
<
num_times
;
j
++
)
{
for
(
int
j
=
0
;
j
<
num_times
;
j
++
)
{
...
@@ -366,9 +367,8 @@ void TestOneThreadPrediction(
...
@@ -366,9 +367,8 @@ void TestOneThreadPrediction(
const
std
::
vector
<
std
::
vector
<
PaddleTensor
>>
&
inputs
,
const
std
::
vector
<
std
::
vector
<
PaddleTensor
>>
&
inputs
,
std
::
vector
<
std
::
vector
<
PaddleTensor
>>
*
outputs
,
bool
use_analysis
=
true
)
{
std
::
vector
<
std
::
vector
<
PaddleTensor
>>
*
outputs
,
bool
use_analysis
=
true
)
{
auto
predictor
=
CreateTestPredictor
(
config
,
use_analysis
);
auto
predictor
=
CreateTestPredictor
(
config
,
use_analysis
);
PredictionWarmUp
(
predictor
.
get
(),
inputs
,
outputs
,
FLAGS_paddle_num_threads
,
PredictionWarmUp
(
predictor
.
get
(),
inputs
,
outputs
,
1
,
0
);
0
);
PredictionRun
(
predictor
.
get
(),
inputs
,
outputs
,
1
,
0
);
PredictionRun
(
predictor
.
get
(),
inputs
,
outputs
,
FLAGS_paddle_num_threads
,
0
);
}
}
void
TestMultiThreadPrediction
(
void
TestMultiThreadPrediction
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录