Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
443f604c
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2297
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
443f604c
编写于
10月 14, 2019
作者:
P
Pei Yang
提交者:
GitHub
10月 14, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add DisableGlogInfo() to AnalysisConfig, test=develop (#20581)
上级
2ff18e53
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
30 addition
and
2 deletion
+30
-2
paddle/fluid/framework/ir/graph_pattern_detector.cc
paddle/fluid/framework/ir/graph_pattern_detector.cc
+1
-2
paddle/fluid/inference/api/analysis_config.cc
paddle/fluid/inference/api/analysis_config.cc
+10
-0
paddle/fluid/inference/api/analysis_predictor.cc
paddle/fluid/inference/api/analysis_predictor.cc
+6
-0
paddle/fluid/inference/api/paddle_analysis_config.h
paddle/fluid/inference/api/paddle_analysis_config.h
+11
-0
paddle/fluid/inference/tests/api/trt_fc_prelu_test.cc
paddle/fluid/inference/tests/api/trt_fc_prelu_test.cc
+1
-0
paddle/fluid/pybind/inference_api.cc
paddle/fluid/pybind/inference_api.cc
+1
-0
未找到文件。
paddle/fluid/framework/ir/graph_pattern_detector.cc
浏览文件 @
443f604c
...
...
@@ -93,8 +93,7 @@ void GraphPatternDetector::operator()(Graph *graph,
ValidateByNodeRole
(
&
subgraphs
);
if
(
subgraphs
.
empty
())
return
;
PrettyLogEndl
(
Style
::
detail
(),
"--- detected %d subgraphs"
,
subgraphs
.
size
());
LOG
(
INFO
)
<<
"--- detected "
<<
subgraphs
.
size
()
<<
" subgraphs"
;
int
id
=
0
;
for
(
auto
&
g
:
subgraphs
)
{
VLOG
(
3
)
<<
"optimizing #"
<<
id
++
<<
" subgraph"
;
...
...
paddle/fluid/inference/api/analysis_config.cc
浏览文件 @
443f604c
...
...
@@ -131,6 +131,9 @@ AnalysisConfig::AnalysisConfig(const AnalysisConfig &other) {
// profile related.
CP_MEMBER
(
with_profile_
);
// glog related.
CP_MEMBER
(
with_glog_info_
);
// Ir related.
CP_MEMBER
(
enable_ir_optim_
);
CP_MEMBER
(
use_feed_fetch_ops_
);
...
...
@@ -382,6 +385,8 @@ std::string AnalysisConfig::SerializeInfoCache() {
ss
<<
with_profile_
;
ss
<<
with_glog_info_
;
ss
<<
enable_ir_optim_
;
ss
<<
use_feed_fetch_ops_
;
ss
<<
ir_debug_
;
...
...
@@ -458,6 +463,11 @@ void AnalysisConfig::EnableProfile() {
Update
();
}
void
AnalysisConfig
::
DisableGlogInfo
()
{
with_glog_info_
=
false
;
Update
();
}
void
AnalysisConfig
::
EnableAnakinEngine
(
int
max_batch_size
,
std
::
map
<
std
::
string
,
std
::
vector
<
int
>>
max_input_shape
,
int
min_subgraph_size
,
AnalysisConfig
::
Precision
precision_mode
,
...
...
paddle/fluid/inference/api/analysis_predictor.cc
浏览文件 @
443f604c
...
...
@@ -506,6 +506,12 @@ std::unique_ptr<PaddlePredictor> CreatePaddlePredictor<
framework
::
InitGflags
(
flags
);
}
}
if
(
config
.
glog_info_disabled
())
{
google
::
InitGoogleLogging
(
"Init"
);
FLAGS_logtostderr
=
1
;
FLAGS_minloglevel
=
google
::
WARNING
;
LOG
(
WARNING
)
<<
" - GLOG's LOG(INFO) is disabled."
;
}
std
::
unique_ptr
<
PaddlePredictor
>
predictor
(
new
AnalysisPredictor
(
config
));
// Each config can only be used for one predictor.
...
...
paddle/fluid/inference/api/paddle_analysis_config.h
浏览文件 @
443f604c
...
...
@@ -257,6 +257,15 @@ struct AnalysisConfig {
*/
bool
profile_enabled
()
const
{
return
with_profile_
;
}
/** \brief Disable GLOG information output for security.
*
* If called, no LOG(INFO) logs will be generated.
*/
void
DisableGlogInfo
();
/** A boolean state telling whether the GLOG info is disabled.
*/
bool
glog_info_disabled
()
const
{
return
!
with_glog_info_
;
}
void
SetInValid
()
const
{
is_valid_
=
false
;
}
bool
is_valid
()
const
{
return
is_valid_
;
}
...
...
@@ -325,6 +334,8 @@ struct AnalysisConfig {
bool
with_profile_
{
false
};
bool
with_glog_info_
{
true
};
// A runtime cache, shouldn't be transferred to others.
std
::
string
serialized_info_cache_
;
...
...
paddle/fluid/inference/tests/api/trt_fc_prelu_test.cc
浏览文件 @
443f604c
...
...
@@ -35,6 +35,7 @@ TEST(ZeroCopyTensor, uint8) {
config
.
SetModel
(
model_dir
);
config
.
SwitchUseFeedFetchOps
(
false
);
config
.
EnableProfile
();
config
.
DisableGlogInfo
();
std
::
vector
<
std
::
vector
<
PaddleTensor
>>
inputs_all
;
auto
predictor
=
CreatePaddlePredictor
(
config
);
...
...
paddle/fluid/pybind/inference_api.cc
浏览文件 @
443f604c
...
...
@@ -338,6 +338,7 @@ void BindAnalysisConfig(py::module *m) {
.
def
(
"ir_optim"
,
&
AnalysisConfig
::
ir_optim
)
.
def
(
"enable_memory_optim"
,
&
AnalysisConfig
::
EnableMemoryOptim
)
.
def
(
"enable_profile"
,
&
AnalysisConfig
::
EnableProfile
)
.
def
(
"disable_glog_info"
,
&
AnalysisConfig
::
DisableGlogInfo
)
.
def
(
"set_optim_cache_dir"
,
&
AnalysisConfig
::
SetOptimCacheDir
)
.
def
(
"switch_use_feed_fetch_ops"
,
&
AnalysisConfig
::
SwitchUseFeedFetchOps
,
py
::
arg
(
"x"
)
=
true
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录