Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
c1235c93
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c1235c93
编写于
1月 09, 2019
作者:
P
peizhilin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add the enable_debug flag
test=develop
上级
c783dd03
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
41 addition
and
11 deletion
+41
-11
paddle/fluid/framework/operator.cc
paddle/fluid/framework/operator.cc
+16
-6
paddle/fluid/framework/operator.h
paddle/fluid/framework/operator.h
+2
-2
paddle/fluid/platform/debug_support.cc
paddle/fluid/platform/debug_support.cc
+9
-0
paddle/fluid/platform/enforce.h
paddle/fluid/platform/enforce.h
+5
-0
python/paddle/fluid/framework.py
python/paddle/fluid/framework.py
+9
-3
未找到文件。
paddle/fluid/framework/operator.cc
浏览文件 @
c1235c93
...
...
@@ -32,6 +32,12 @@ DEFINE_bool(check_nan_inf, false,
"Checking whether operator produce NAN/INF or not. It will be "
"extremely slow so please use this flag wisely."
);
DEFINE_bool
(
enable_debug
,
false
,
"The enable_debug indicate whether to give more detail information when, "
"use the paddlepaddle. However it may deduce the performance since it has"
"to record the information during runtime."
);
namespace
paddle
{
namespace
framework
{
...
...
@@ -157,7 +163,7 @@ RuntimeContext::RuntimeContext(const VariableNameMap& innames,
}
}
void
OperatorBase
::
PreHook
()
{
void
OperatorBase
::
PreHook
(
const
Scope
&
scope
,
const
platform
::
Place
&
place
)
{
auto
attrName
=
OpProtoAndCheckerMaker
::
OpCreationCallstackAttrName
();
if
(
HasAttr
(
attrName
))
{
auto
&
callstack
=
Attr
<
std
::
vector
<
std
::
string
>>
(
attrName
);
...
...
@@ -166,8 +172,10 @@ void OperatorBase::PreHook() {
}
void
OperatorBase
::
Run
(
const
Scope
&
scope
,
const
platform
::
Place
&
place
)
{
VLOG
(
4
)
<<
"Call the prehook ... "
;
PreHook
();
if
(
FLAGS_enable_debug
)
{
VLOG
(
4
)
<<
"Call the prehook ... "
;
PreHook
(
scope
,
place
);
}
VLOG
(
4
)
<<
place
<<
" "
<<
DebugStringEx
(
&
scope
);
if
(
platform
::
is_gpu_place
(
place
))
{
...
...
@@ -191,11 +199,13 @@ void OperatorBase::Run(const Scope& scope, const platform::Place& place) {
}
VLOG
(
3
)
<<
place
<<
" "
<<
DebugStringEx
(
&
scope
);
VLOG
(
4
)
<<
"Call the posthook ... "
;
PostHook
();
if
(
FLAGS_enable_debug
)
{
VLOG
(
4
)
<<
"Call the posthook ... "
;
PostHook
(
scope
,
place
);
}
}
void
OperatorBase
::
PostHook
()
{
void
OperatorBase
::
PostHook
(
const
Scope
&
scope
,
const
platform
::
Place
&
place
)
{
// do nothing here
}
...
...
paddle/fluid/framework/operator.h
浏览文件 @
c1235c93
...
...
@@ -161,8 +161,8 @@ class OperatorBase {
const
RuntimeContext
&
ctx
)
const
{}
// Add the hooks
virtual
void
PreHook
();
virtual
void
PostHook
();
virtual
void
PreHook
(
const
Scope
&
scope
,
const
platform
::
Place
&
place
);
virtual
void
PostHook
(
const
Scope
&
scope
,
const
platform
::
Place
&
place
);
protected:
std
::
string
type_
;
...
...
paddle/fluid/platform/debug_support.cc
浏览文件 @
c1235c93
...
...
@@ -27,6 +27,15 @@ std::string PythonDebugSupport::Format() const {
for
(
auto
&
line
:
info
)
{
sout
<<
line
;
}
}
else
{
#ifdef _WIN32
sout
<<
"please set FLAGS_enable_debug=True to get more details regard to "
"this failure.
\n
"
;
#else // _WIN32
sout
<<
"please export FLAGS_enable_debug=True to get more details regard "
"to "
"this failure.
\n
"
;
#endif // _WIN32
}
return
sout
.
str
();
}
...
...
paddle/fluid/platform/enforce.h
浏览文件 @
c1235c93
...
...
@@ -265,6 +265,10 @@ inline void throw_on_error(T e) {
#define __THROW_ON_ERROR_ONE_ARG(COND, ARG) \
::paddle::platform::throw_on_error(COND, ::paddle::string::Sprintf(ARG));
#ifdef _WIN32
#define __PADDLE_THROW_ON_ERROR(COND, ...) \
__THROW_ON_ERROR_ONE_ARG(COND, __VA_ARGS__)
#else // _WIN32
#define __PADDLE_THROW_ON_ERROR(COND, ...) \
__PADDLE_THROW_ERROR_I( \
__VA_ARGS__, ::paddle::platform::throw_on_error(COND, __VA_ARGS__), \
...
...
@@ -276,6 +280,7 @@ inline void throw_on_error(T e) {
::paddle::platform::throw_on_error(COND, __VA_ARGS__), \
::paddle::platform::throw_on_error(COND, __VA_ARGS__), \
__THROW_ON_ERROR_ONE_ARG(COND, __VA_ARGS__))
#endif // _WIN32
#define __PADDLE_UNARY_COMPARE(COND, ...) \
do { \
...
...
python/paddle/fluid/framework.py
浏览文件 @
c1235c93
...
...
@@ -627,9 +627,15 @@ class Operator(object):
if
role_var_name
in
op_attrs
and
len
(
op_attrs
[
role_var_name
])
==
0
:
del
op_attrs
[
role_var_name
]
callstack_var_name
=
op_maker
.
kOpCreationCallstackAttrName
()
op_attrs
[
callstack_var_name
]
=
list
(
reversed
(
traceback
.
format_stack
()))[
1
:]
if
'FLAGS_enable_debug'
in
os
.
environ
and
os
.
environ
[
'FLAGS_enable_debug'
]:
callstack_var_name
=
op_maker
.
kOpCreationCallstackAttrName
()
op_attrs
[
callstack_var_name
]
=
list
(
reversed
(
traceback
.
format_stack
()))[
1
:]
op_attrs
[
callstack_var_name
].
insert
(
0
,
'Invoke operator '
+
(
''
if
type
is
None
else
type
)
+
' error.
\n
'
)
if
len
(
self
.
desc
.
type
())
!=
0
:
return
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录