Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
8814bec0
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看板
提交
8814bec0
编写于
1月 07, 2018
作者:
E
emailweixu
提交者:
dzhwinter
1月 08, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Show argument dimensions with operator::DebugStringEx (#7268)
This can make it easier to locate error.
上级
a9f7cd34
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
28 addition
and
7 deletion
+28
-7
paddle/framework/executor.cc
paddle/framework/executor.cc
+1
-1
paddle/framework/operator.cc
paddle/framework/operator.cc
+18
-1
paddle/framework/operator.h
paddle/framework/operator.h
+4
-1
paddle/operators/net_op.cc
paddle/operators/net_op.cc
+3
-3
paddle/operators/net_op.h
paddle/operators/net_op.h
+2
-1
未找到文件。
paddle/framework/executor.cc
浏览文件 @
8814bec0
...
@@ -111,7 +111,7 @@ void Executor::Run(const ProgramDesc& pdesc, Scope* scope, int block_id,
...
@@ -111,7 +111,7 @@ void Executor::Run(const ProgramDesc& pdesc, Scope* scope, int block_id,
for
(
auto
&
op_desc
:
block
.
AllOps
())
{
for
(
auto
&
op_desc
:
block
.
AllOps
())
{
auto
op
=
paddle
::
framework
::
OpRegistry
::
CreateOp
(
*
op_desc
);
auto
op
=
paddle
::
framework
::
OpRegistry
::
CreateOp
(
*
op_desc
);
VLOG
(
3
)
<<
op
->
DebugString
(
);
VLOG
(
3
)
<<
op
->
DebugString
Ex
(
local_scope
);
op
->
Run
(
*
local_scope
,
place_
);
op
->
Run
(
*
local_scope
,
place_
);
if
(
FLAGS_check_nan_inf
)
{
if
(
FLAGS_check_nan_inf
)
{
for
(
auto
&
vname
:
op
->
OutputVars
(
true
))
{
for
(
auto
&
vname
:
op
->
OutputVars
(
true
))
{
...
...
paddle/framework/operator.cc
浏览文件 @
8814bec0
...
@@ -73,6 +73,17 @@ void UseALL() {
...
@@ -73,6 +73,17 @@ void UseALL() {
UseCUDNN
();
UseCUDNN
();
}
}
static
DDim
GetDims
(
const
Scope
&
scope
,
const
std
::
string
&
name
)
{
Variable
*
var
=
scope
.
FindVar
(
name
);
if
(
var
->
IsType
<
LoDTensor
>
())
{
return
var
->
Get
<
LoDTensor
>
().
dims
();
}
else
if
(
var
->
IsType
<
SelectedRows
>
())
{
return
var
->
Get
<
SelectedRows
>
().
GetCompleteDims
();
}
else
{
return
DDim
({
-
1
});
}
}
std
::
string
OperatorBase
::
Input
(
const
std
::
string
&
name
)
const
{
std
::
string
OperatorBase
::
Input
(
const
std
::
string
&
name
)
const
{
auto
&
ins
=
Inputs
(
name
);
auto
&
ins
=
Inputs
(
name
);
PADDLE_ENFORCE_LE
(
ins
.
size
(),
1UL
,
PADDLE_ENFORCE_LE
(
ins
.
size
(),
1UL
,
...
@@ -105,7 +116,7 @@ const std::vector<std::string>& OperatorBase::Outputs(
...
@@ -105,7 +116,7 @@ const std::vector<std::string>& OperatorBase::Outputs(
return
it
->
second
;
return
it
->
second
;
}
}
std
::
string
OperatorBase
::
DebugString
(
)
const
{
std
::
string
OperatorBase
::
DebugString
Ex
(
const
Scope
*
scope
)
const
{
std
::
stringstream
ss
;
std
::
stringstream
ss
;
ss
<<
"Op("
<<
type_
<<
"), inputs:{"
;
ss
<<
"Op("
<<
type_
<<
"), inputs:{"
;
for
(
auto
it
=
inputs_
.
begin
();
it
!=
inputs_
.
end
();)
{
for
(
auto
it
=
inputs_
.
begin
();
it
!=
inputs_
.
end
();)
{
...
@@ -113,6 +124,9 @@ std::string OperatorBase::DebugString() const {
...
@@ -113,6 +124,9 @@ std::string OperatorBase::DebugString() const {
ss
<<
input
.
first
<<
"["
;
ss
<<
input
.
first
<<
"["
;
for
(
size_t
i
=
0
;
i
<
input
.
second
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
input
.
second
.
size
();
++
i
)
{
ss
<<
input
.
second
[
i
];
ss
<<
input
.
second
[
i
];
if
(
scope
)
{
ss
<<
"("
<<
GetDims
(
*
scope
,
input
.
second
[
i
])
<<
")"
;
}
if
(
i
!=
input
.
second
.
size
()
-
1
)
{
if
(
i
!=
input
.
second
.
size
()
-
1
)
{
ss
<<
", "
;
ss
<<
", "
;
}
}
...
@@ -129,6 +143,9 @@ std::string OperatorBase::DebugString() const {
...
@@ -129,6 +143,9 @@ std::string OperatorBase::DebugString() const {
ss
<<
output
.
first
<<
"["
;
ss
<<
output
.
first
<<
"["
;
for
(
size_t
i
=
0
;
i
<
output
.
second
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
output
.
second
.
size
();
++
i
)
{
ss
<<
output
.
second
[
i
];
ss
<<
output
.
second
[
i
];
if
(
scope
)
{
ss
<<
"("
<<
GetDims
(
*
scope
,
output
.
second
[
i
])
<<
")"
;
}
if
(
i
!=
output
.
second
.
size
()
-
1
)
{
if
(
i
!=
output
.
second
.
size
()
-
1
)
{
ss
<<
", "
;
ss
<<
", "
;
}
}
...
...
paddle/framework/operator.h
浏览文件 @
8814bec0
...
@@ -108,7 +108,10 @@ class OperatorBase {
...
@@ -108,7 +108,10 @@ class OperatorBase {
return
boost
::
get
<
T
>
(
attrs_
.
at
(
name
));
return
boost
::
get
<
T
>
(
attrs_
.
at
(
name
));
}
}
virtual
std
::
string
DebugString
()
const
;
/// if scope is not null, also show dimensions of arguments
virtual
std
::
string
DebugStringEx
(
const
Scope
*
scope
)
const
;
std
::
string
DebugString
()
const
{
return
DebugStringEx
(
nullptr
);
}
/// Net will call this function to Run an op.
/// Net will call this function to Run an op.
virtual
void
Run
(
const
Scope
&
scope
,
const
platform
::
Place
&
place
)
const
=
0
;
virtual
void
Run
(
const
Scope
&
scope
,
const
platform
::
Place
&
place
)
const
=
0
;
...
...
paddle/operators/net_op.cc
浏览文件 @
8814bec0
...
@@ -56,11 +56,11 @@ void NetOp::CompleteAddOp(bool calc) {
...
@@ -56,11 +56,11 @@ void NetOp::CompleteAddOp(bool calc) {
std
::
copy
(
output_set
.
begin
(),
output_set
.
end
(),
std
::
back_inserter
(
outputs
));
std
::
copy
(
output_set
.
begin
(),
output_set
.
end
(),
std
::
back_inserter
(
outputs
));
}
}
std
::
string
NetOp
::
DebugString
(
)
const
{
std
::
string
NetOp
::
DebugString
Ex
(
const
framework
::
Scope
*
scope
)
const
{
std
::
ostringstream
os
;
std
::
ostringstream
os
;
os
<<
OperatorBase
::
DebugString
(
)
<<
std
::
endl
;
os
<<
OperatorBase
::
DebugString
Ex
(
scope
)
<<
std
::
endl
;
for
(
auto
&
op
:
ops_
)
{
for
(
auto
&
op
:
ops_
)
{
std
::
istringstream
is
(
op
->
DebugString
(
));
std
::
istringstream
is
(
op
->
DebugString
Ex
(
scope
));
for
(
std
::
string
line
;
std
::
getline
(
is
,
line
);)
{
for
(
std
::
string
line
;
std
::
getline
(
is
,
line
);)
{
os
<<
" "
<<
line
<<
std
::
endl
;
os
<<
" "
<<
line
<<
std
::
endl
;
}
}
...
...
paddle/operators/net_op.h
浏览文件 @
8814bec0
...
@@ -106,7 +106,8 @@ class NetOp : public framework::OperatorBase {
...
@@ -106,7 +106,8 @@ class NetOp : public framework::OperatorBase {
void
CompleteAddOp
(
bool
calculate
=
true
);
void
CompleteAddOp
(
bool
calculate
=
true
);
std
::
string
DebugString
()
const
override
;
std
::
string
DebugStringEx
(
const
framework
::
Scope
*
scope
=
nullptr
)
const
override
;
bool
IsNetOp
()
const
override
;
bool
IsNetOp
()
const
override
;
std
::
vector
<
std
::
string
>
OutputVars
(
bool
has_intermediate
)
const
override
;
std
::
vector
<
std
::
string
>
OutputVars
(
bool
has_intermediate
)
const
override
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录