Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
b94307a9
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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,发现更多精彩内容 >>
提交
b94307a9
编写于
2月 28, 2019
作者:
Y
Yiqun Liu
提交者:
ceci3
3月 04, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Optimize while_op when is_test is true. (#15811)" (#15968)
test=develop
上级
eeb70edd
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
5 addition
and
30 deletion
+5
-30
paddle/fluid/framework/lod_rank_table.cc
paddle/fluid/framework/lod_rank_table.cc
+0
-4
paddle/fluid/operators/controlflow/while_op.cc
paddle/fluid/operators/controlflow/while_op.cc
+5
-26
未找到文件。
paddle/fluid/framework/lod_rank_table.cc
浏览文件 @
b94307a9
...
@@ -19,10 +19,6 @@ namespace framework {
...
@@ -19,10 +19,6 @@ namespace framework {
void
LoDRankTable
::
Reset
(
const
LoD
&
lod
,
size_t
level
)
{
void
LoDRankTable
::
Reset
(
const
LoD
&
lod
,
size_t
level
)
{
this
->
coarse_lod_
.
clear
();
this
->
coarse_lod_
.
clear
();
this
->
items_
.
clear
();
this
->
items_
.
clear
();
if
(
lod
.
size
()
==
0
)
{
// Reset to a empty rank table.
return
;
}
PADDLE_ENFORCE
(
level
<
lod
.
size
(),
PADDLE_ENFORCE
(
level
<
lod
.
size
(),
"Cannot rank lod since the level %d is less than lod size %d"
,
"Cannot rank lod since the level %d is less than lod size %d"
,
level
,
lod
.
size
());
level
,
lod
.
size
());
...
...
paddle/fluid/operators/controlflow/while_op.cc
浏览文件 @
b94307a9
...
@@ -58,7 +58,6 @@ class WhileOp : public framework::OperatorBase {
...
@@ -58,7 +58,6 @@ class WhileOp : public framework::OperatorBase {
void
RunImpl
(
const
framework
::
Scope
&
scope
,
void
RunImpl
(
const
framework
::
Scope
&
scope
,
const
platform
::
Place
&
dev_place
)
const
override
{
const
platform
::
Place
&
dev_place
)
const
override
{
PADDLE_ENFORCE_NOT_NULL
(
scope
.
FindVar
(
Input
(
kCondition
)));
PADDLE_ENFORCE_NOT_NULL
(
scope
.
FindVar
(
Input
(
kCondition
)));
auto
&
cond
=
scope
.
FindVar
(
Input
(
kCondition
))
->
Get
<
LoDTensor
>
();
auto
&
cond
=
scope
.
FindVar
(
Input
(
kCondition
))
->
Get
<
LoDTensor
>
();
PADDLE_ENFORCE_EQ
(
cond
.
dims
(),
paddle
::
framework
::
make_ddim
({
1
}));
PADDLE_ENFORCE_EQ
(
cond
.
dims
(),
paddle
::
framework
::
make_ddim
({
1
}));
...
@@ -78,35 +77,15 @@ class WhileOp : public framework::OperatorBase {
...
@@ -78,35 +77,15 @@ class WhileOp : public framework::OperatorBase {
VLOG
(
2
)
<<
GetSkipEagerDeletionVarsDebugString
(
skip_vars
);
VLOG
(
2
)
<<
GetSkipEagerDeletionVarsDebugString
(
skip_vars
);
auto
ctx
=
executor
.
Prepare
(
*
program
,
block
->
ID
(),
skip_vars
);
auto
ctx
=
executor
.
Prepare
(
*
program
,
block
->
ID
(),
skip_vars
);
if
(
!
is_test
)
{
while
(
cond
.
data
<
bool
>
()[
0
])
{
while
(
cond
.
data
<
bool
>
()[
0
])
{
auto
&
current_scope
=
scope
.
NewScope
();
auto
&
current_scope
=
scope
.
NewScope
();
step_scopes
->
push_back
(
&
current_scope
);
step_scopes
->
push_back
(
&
current_scope
);
executor
.
RunPreparedContext
(
ctx
.
get
(),
&
current_scope
,
false
,
true
,
executor
.
RunPreparedContext
(
ctx
.
get
(),
&
current_scope
,
false
,
true
,
true
);
true
);
if
(
is_test
)
{
}
}
else
{
auto
&
current_scope
=
scope
.
NewScope
();
executor
.
CreateVariables
(
*
program
,
&
current_scope
,
block
->
ID
());
while
(
cond
.
data
<
bool
>
()[
0
])
{
for
(
auto
&
name
:
current_scope
.
LocalVarNames
())
{
auto
*
var
=
current_scope
.
Var
(
name
);
framework
::
LoD
empty_lod
;
if
(
var
->
IsType
<
framework
::
LoDTensor
>
())
{
// Clear all lod information for all lod_tensors.
auto
*
t
=
var
->
GetMutable
<
framework
::
LoDTensor
>
();
t
->
set_lod
(
empty_lod
);
}
else
if
(
var
->
IsType
<
framework
::
LoDRankTable
>
())
{
auto
*
t
=
var
->
GetMutable
<
framework
::
LoDRankTable
>
();
t
->
Reset
(
empty_lod
,
0
);
}
}
executor
.
RunPreparedContext
(
ctx
.
get
(),
&
current_scope
,
false
,
false
,
false
);
}
scope
.
DeleteScope
(
&
current_scope
);
scope
.
DeleteScope
(
&
current_scope
);
}
}
}
}
}
};
};
class
WhileOpMaker
:
public
framework
::
OpProtoAndCheckerMaker
{
class
WhileOpMaker
:
public
framework
::
OpProtoAndCheckerMaker
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录