Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
d0b71349
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看板
未验证
提交
d0b71349
编写于
6年前
作者:
Q
Qiao Longfei
提交者:
GitHub
6年前
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enhance DebugStringEx (#12949)
上级
eca4563e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
36 addition
and
16 deletion
+36
-16
paddle/fluid/framework/operator.cc
paddle/fluid/framework/operator.cc
+36
-16
未找到文件。
paddle/fluid/framework/operator.cc
浏览文件 @
d0b71349
...
...
@@ -74,6 +74,12 @@ static DDim GetDims(const Scope& scope, const std::string& name,
}
}
static
bool
VarInited
(
const
Scope
&
scope
,
const
std
::
string
&
name
)
{
Variable
*
var
=
scope
.
FindVar
(
name
);
if
(
var
==
nullptr
)
return
false
;
return
var
->
IsInitialized
();
}
static
std
::
string
GetDtype
(
const
Scope
&
scope
,
const
std
::
string
&
name
)
{
Variable
*
var
=
scope
.
FindVar
(
name
);
if
(
var
==
nullptr
)
{
...
...
@@ -87,8 +93,12 @@ static std::string GetDtype(const Scope& scope, const std::string& name) {
}
return
DataTypeToString
(
ToDataType
(
tensor
.
type
()));
}
else
if
(
var
->
IsType
<
SelectedRows
>
())
{
return
DataTypeToString
(
ToDataType
(
var
->
Get
<
SelectedRows
>
().
value
().
type
()));
auto
tensor
=
var
->
Get
<
SelectedRows
>
().
value
();
if
(
UNLIKELY
(
!
tensor
.
IsInitialized
()))
{
return
"uninited"
;
}
else
{
return
DataTypeToString
(
ToDataType
(
tensor
.
type
()));
}
}
else
{
return
""
;
}
...
...
@@ -197,16 +207,21 @@ std::string OperatorBase::DebugStringEx(const Scope* scope) const {
auto
&
input
=
*
it
;
ss
<<
input
.
first
<<
"["
;
for
(
size_t
i
=
0
;
i
<
input
.
second
.
size
();
++
i
)
{
ss
<<
input
.
second
[
i
];
auto
var_name
=
input
.
second
[
i
];
ss
<<
var_name
;
if
(
scope
)
{
int
row_size
=
GetRowSize
(
*
scope
,
input
.
second
[
i
]);
if
(
row_size
>=
0
)
{
ss
<<
"[row_size="
<<
row_size
<<
"]"
;
if
(
!
VarInited
(
*
scope
,
var_name
))
{
ss
<<
"[uninited]"
;
}
else
{
int
row_size
=
GetRowSize
(
*
scope
,
var_name
);
if
(
row_size
>=
0
)
{
ss
<<
"[row_size="
<<
row_size
<<
"]"
;
}
std
::
string
dtype
=
GetDtype
(
*
scope
,
var_name
);
ss
<<
":"
<<
dtype
;
ss
<<
"["
<<
GetDims
(
*
scope
,
var_name
,
true
)
<<
"]"
;
ss
<<
"("
<<
GetLoD
(
*
scope
,
var_name
)
<<
")"
;
}
std
::
string
dtype
=
GetDtype
(
*
scope
,
input
.
second
[
i
]);
ss
<<
":"
<<
dtype
;
ss
<<
"["
<<
GetDims
(
*
scope
,
input
.
second
[
i
],
true
)
<<
"]"
;
ss
<<
"("
<<
GetLoD
(
*
scope
,
input
.
second
[
i
])
<<
")"
;
}
if
(
i
!=
input
.
second
.
size
()
-
1
)
{
ss
<<
", "
;
...
...
@@ -223,14 +238,19 @@ std::string OperatorBase::DebugStringEx(const Scope* scope) const {
auto
&
output
=
*
it
;
ss
<<
output
.
first
<<
"["
;
for
(
size_t
i
=
0
;
i
<
output
.
second
.
size
();
++
i
)
{
ss
<<
output
.
second
[
i
];
auto
var_name
=
output
.
second
[
i
];
ss
<<
var_name
;
if
(
scope
)
{
int
row_size
=
GetRowSize
(
*
scope
,
output
.
second
[
i
]);
if
(
row_size
>=
0
)
{
ss
<<
"[row_size="
<<
row_size
<<
"]"
;
if
(
!
VarInited
(
*
scope
,
var_name
))
{
ss
<<
"[uninited]"
;
}
else
{
int
row_size
=
GetRowSize
(
*
scope
,
output
.
second
[
i
]);
if
(
row_size
>=
0
)
{
ss
<<
"[row_size="
<<
row_size
<<
"]"
;
}
ss
<<
"["
<<
GetDims
(
*
scope
,
var_name
,
true
)
<<
"]"
;
ss
<<
"("
<<
GetLoD
(
*
scope
,
var_name
)
<<
")"
;
}
ss
<<
"["
<<
GetDims
(
*
scope
,
output
.
second
[
i
],
true
)
<<
"]"
;
ss
<<
"("
<<
GetLoD
(
*
scope
,
output
.
second
[
i
])
<<
")"
;
}
if
(
i
!=
output
.
second
.
size
()
-
1
)
{
ss
<<
", "
;
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
新手
引导
客服
返回
顶部