Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
6b104c90
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看板
提交
6b104c90
编写于
9月 06, 2018
作者:
T
tensor-tang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix profile
上级
4d774953
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
20 addition
and
12 deletion
+20
-12
paddle/fluid/inference/analysis/analyzer_lac_tester.cc
paddle/fluid/inference/analysis/analyzer_lac_tester.cc
+7
-12
paddle/fluid/inference/api/analysis_predictor.cc
paddle/fluid/inference/api/analysis_predictor.cc
+13
-0
未找到文件。
paddle/fluid/inference/analysis/analyzer_lac_tester.cc
浏览文件 @
6b104c90
...
@@ -178,6 +178,7 @@ void TestLACPrediction(const std::string &model_path,
...
@@ -178,6 +178,7 @@ void TestLACPrediction(const std::string &model_path,
cfg
.
device
=
0
;
cfg
.
device
=
0
;
cfg
.
specify_input_name
=
true
;
cfg
.
specify_input_name
=
true
;
cfg
.
enable_ir_optim
=
true
;
cfg
.
enable_ir_optim
=
true
;
cfg
.
ir_passes
.
push_back
(
"fc_gru_fuse_pass"
);
predictor
=
predictor
=
CreatePaddlePredictor
<
AnalysisConfig
,
PaddleEngineKind
::
kAnalysis
>
(
cfg
);
CreatePaddlePredictor
<
AnalysisConfig
,
PaddleEngineKind
::
kAnalysis
>
(
cfg
);
}
else
{
}
else
{
...
@@ -208,13 +209,6 @@ void TestLACPrediction(const std::string &model_path,
...
@@ -208,13 +209,6 @@ void TestLACPrediction(const std::string &model_path,
PrintTime
(
timer
.
toc
(),
batch_size
,
repeat
);
PrintTime
(
timer
.
toc
(),
batch_size
,
repeat
);
// check result
// check result
if
(
use_analysis
)
{
// run once for comparion as reference
auto
ref_predictor
=
CreatePaddlePredictor
<
NativeConfig
,
PaddleEngineKind
::
kNative
>
(
config
);
ref_predictor
->
Run
(
input_slots
,
&
ref_outputs_slots
);
}
EXPECT_EQ
(
outputs_slots
.
size
(),
1UL
);
EXPECT_EQ
(
outputs_slots
.
size
(),
1UL
);
auto
&
out
=
outputs_slots
[
0
];
auto
&
out
=
outputs_slots
[
0
];
size_t
size
=
std
::
accumulate
(
out
.
shape
.
begin
(),
out
.
shape
.
end
(),
1
,
size_t
size
=
std
::
accumulate
(
out
.
shape
.
begin
(),
out
.
shape
.
end
(),
1
,
...
@@ -228,6 +222,10 @@ void TestLACPrediction(const std::string &model_path,
...
@@ -228,6 +222,10 @@ void TestLACPrediction(const std::string &model_path,
}
}
if
(
use_analysis
)
{
if
(
use_analysis
)
{
// run once for comparion as reference
auto
ref_predictor
=
CreatePaddlePredictor
<
NativeConfig
,
PaddleEngineKind
::
kNative
>
(
config
);
ref_predictor
->
Run
(
input_slots
,
&
ref_outputs_slots
);
EXPECT_EQ
(
ref_outputs_slots
.
size
(),
outputs_slots
.
size
());
EXPECT_EQ
(
ref_outputs_slots
.
size
(),
outputs_slots
.
size
());
auto
&
ref_out
=
ref_outputs_slots
[
0
];
auto
&
ref_out
=
ref_outputs_slots
[
0
];
size_t
ref_size
=
size_t
ref_size
=
...
@@ -256,12 +254,9 @@ void TestLACPrediction(const std::string &model_path,
...
@@ -256,12 +254,9 @@ void TestLACPrediction(const std::string &model_path,
}
}
LOG
(
INFO
)
<<
"has num ops: "
<<
num_ops
;
LOG
(
INFO
)
<<
"has num ops: "
<<
num_ops
;
ASSERT_TRUE
(
fuse_statis
.
count
(
"fc_fuse"
));
ASSERT_TRUE
(
fuse_statis
.
count
(
"fc_fuse"
));
ASSERT_TRUE
(
fuse_statis
.
count
(
"fc_gru_fuse"
));
LOG
(
INFO
)
<<
"fc fuse num:"
<<
fuse_statis
.
at
(
"fc_fuse"
);
LOG
(
INFO
)
<<
"fc gru fuse num:"
<<
fuse_statis
.
at
(
"fc_gru_fuse"
);
// ASSERT_TRUE(fuse_statis.count("fc_gru_fuse"));
// ASSERT_TRUE(fuse_statis.count("fc_gru_fuse"));
// LOG(INFO) << fuse_statis.at("fc_gru_fuse");
LOG
(
INFO
)
<<
"fc fuse num:"
<<
fuse_statis
.
at
(
"fc_fuse"
);
// LOG(INFO) << "fc gru fuse num:" << fuse_statis.at("fc_gru_fuse");
}
}
}
}
...
...
paddle/fluid/inference/api/analysis_predictor.cc
浏览文件 @
6b104c90
...
@@ -22,12 +22,25 @@
...
@@ -22,12 +22,25 @@
#include "paddle/fluid/inference/api/paddle_inference_api.h"
#include "paddle/fluid/inference/api/paddle_inference_api.h"
#include "paddle/fluid/inference/api/paddle_inference_pass.h"
#include "paddle/fluid/inference/api/paddle_inference_pass.h"
#include "paddle/fluid/inference/utils/singleton.h"
#include "paddle/fluid/inference/utils/singleton.h"
#include "paddle/fluid/platform/profiler.h"
DECLARE_bool
(
profile
);
namespace
paddle
{
namespace
paddle
{
bool
AnalysisPredictor
::
Init
(
bool
AnalysisPredictor
::
Init
(
const
std
::
shared_ptr
<
framework
::
Scope
>&
parent_scope
)
{
const
std
::
shared_ptr
<
framework
::
Scope
>&
parent_scope
)
{
VLOG
(
3
)
<<
"Predictor::init()"
;
VLOG
(
3
)
<<
"Predictor::init()"
;
#if !defined(_WIN32)
if
(
FLAGS_profile
)
{
LOG
(
WARNING
)
<<
"Profiler is actived, might affect the performance"
;
LOG
(
INFO
)
<<
"You can turn off by set gflags '-profile false'"
;
auto
tracking_device
=
config_
.
use_gpu
?
platform
::
ProfilerState
::
kAll
:
platform
::
ProfilerState
::
kCPU
;
platform
::
EnableProfiler
(
tracking_device
);
}
#endif
if
(
config_
.
use_gpu
)
{
if
(
config_
.
use_gpu
)
{
place_
=
paddle
::
platform
::
CUDAPlace
(
config_
.
device
);
place_
=
paddle
::
platform
::
CUDAPlace
(
config_
.
device
);
LOG
(
WARNING
)
<<
"ir optimize only supports CPU currently"
;
LOG
(
WARNING
)
<<
"ir optimize only supports CPU currently"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录