Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ujs_wantz
Paddle
提交
4812eda5
P
Paddle
项目概览
ujs_wantz
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
4812eda5
编写于
11月 23, 2021
作者:
W
wanghuancoder
提交者:
GitHub
11月 23, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
set feed var skip inplace, test=develop (#37467)
上级
df14dbf0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
37 addition
and
3 deletion
+37
-3
paddle/fluid/framework/new_executor/interpretercore.cc
paddle/fluid/framework/new_executor/interpretercore.cc
+18
-1
paddle/fluid/framework/new_executor/interpretercore.h
paddle/fluid/framework/new_executor/interpretercore.h
+3
-1
paddle/fluid/framework/new_executor/new_executor_defs.cc
paddle/fluid/framework/new_executor/new_executor_defs.cc
+10
-0
paddle/fluid/framework/new_executor/new_executor_defs.h
paddle/fluid/framework/new_executor/new_executor_defs.h
+5
-0
paddle/fluid/framework/new_executor/standalone_executor.cc
paddle/fluid/framework/new_executor/standalone_executor.cc
+1
-1
未找到文件。
paddle/fluid/framework/new_executor/interpretercore.cc
浏览文件 @
4812eda5
...
...
@@ -93,7 +93,8 @@ paddle::framework::FetchList InterpreterCore::Run(
return
*
(
fetch_var
->
GetMutable
<
framework
::
FetchList
>
());
}
paddle
::
framework
::
FetchList
InterpreterCore
::
Run
()
{
paddle
::
framework
::
FetchList
InterpreterCore
::
Run
(
const
std
::
vector
<
std
::
string
>&
feed_names
)
{
if
(
!
is_build_
)
{
if
(
create_local_scope_
&&
global_scope_
->
GetMutableLocalScope
()
!=
...
...
@@ -113,6 +114,7 @@ paddle::framework::FetchList InterpreterCore::Run() {
paddle
::
framework
::
interpreter
::
build_op_func_list
(
place_
,
block_
,
&
op_func_nodes
,
global_scope_
,
create_local_scope_
);
is_build_
=
true
;
SetFeedVarsInplaceSkip
(
feed_names
);
// convert vec func_list to graph
Convert
(
&
op_func_nodes
);
...
...
@@ -260,6 +262,13 @@ void InterpreterCore::BuildInplace() {
for
(
auto
&
pair
:
in_to_outs
)
{
auto
iter
=
inputs
.
find
(
pair
.
first
);
if
(
iter
!=
inputs
.
end
()
&&
!
iter
->
second
.
empty
())
{
auto
in_var_desc
=
global_scope_
->
VarDesc
(
iter
->
second
[
0
]);
if
(
in_var_desc
&&
in_var_desc
->
Persistable
())
{
continue
;
}
if
(
global_scope_
->
GetVarSikpInplace
(
iter
->
second
[
0
]))
{
continue
;
}
if
(
BuildInplaceCheckVarIsOnlyInput
(
iter
->
second
[
0
]))
{
auto
iterout
=
outputs
.
find
(
pair
.
second
);
if
(
iterout
!=
outputs
.
end
()
&&
!
iterout
->
second
.
empty
())
{
...
...
@@ -578,6 +587,7 @@ void InterpreterCore::Prepare(
paddle
::
framework
::
interpreter
::
build_op_func_list
(
place_
,
block_
,
&
op_func_nodes
,
global_scope_
,
create_local_scope_
);
is_build_
=
true
;
SetFeedVarsInplaceSkip
(
feed_names
);
// convert vec func_list to graph
Convert
(
&
op_func_nodes
);
}
...
...
@@ -604,5 +614,12 @@ interpreter::CostInfo InterpreterCore::DryRun(
return
cost_info
;
}
void
InterpreterCore
::
SetFeedVarsInplaceSkip
(
const
std
::
vector
<
std
::
string
>&
feed_names
)
{
for
(
auto
&
feed_name
:
feed_names
)
{
global_scope_
->
SetVarSikpInplace
(
feed_name
,
true
);
}
}
}
// namespace framework
}
// namespace paddle
paddle/fluid/framework/new_executor/interpretercore.h
浏览文件 @
4812eda5
...
...
@@ -49,7 +49,7 @@ class InterpreterCore {
const
std
::
vector
<
std
::
string
>&
feed_names
,
const
std
::
vector
<
framework
::
LoDTensor
>&
feed_tensors
);
paddle
::
framework
::
FetchList
Run
();
paddle
::
framework
::
FetchList
Run
(
const
std
::
vector
<
std
::
string
>&
feed_names
);
interpreter
::
CostInfo
DryRun
(
const
std
::
vector
<
std
::
string
>&
feed_names
,
...
...
@@ -84,6 +84,8 @@ class InterpreterCore {
void
BuildOperatorDependences
();
void
SetFeedVarsInplaceSkip
(
const
std
::
vector
<
std
::
string
>&
feed_names
);
bool
is_build_
;
const
platform
::
Place
&
place_
;
...
...
paddle/fluid/framework/new_executor/new_executor_defs.cc
浏览文件 @
4812eda5
...
...
@@ -598,6 +598,16 @@ paddle::framework::VarDesc* VariableScope::VarDesc(int id) const {
return
vec_meta_info_
[
id
].
var_desc_
;
}
void
VariableScope
::
SetVarSikpInplace
(
const
std
::
string
&
name
,
bool
skip
)
{
CheckExist
(
name
);
vec_meta_info_
[
VarId
(
name
)].
sikp_inplace_
=
skip
;
}
bool
VariableScope
::
GetVarSikpInplace
(
int
id
)
const
{
CheckExist
(
id
);
return
vec_meta_info_
[
id
].
sikp_inplace_
;
}
void
VariableScope
::
CheckExist
(
int
id
)
const
{
PADDLE_ENFORCE_LT
(
id
,
var_list_
.
size
(),
platform
::
errors
::
PreconditionNotMet
(
...
...
paddle/fluid/framework/new_executor/new_executor_defs.h
浏览文件 @
4812eda5
...
...
@@ -145,6 +145,7 @@ struct OpKernelFunc {
struct
VariableMetaInfo
{
int
var_ref_count_
{
0
};
framework
::
VarDesc
*
var_desc_
{
nullptr
};
bool
sikp_inplace_
{
false
};
VariableMetaInfo
()
{}
VariableMetaInfo
(
int
var_ref_count
,
framework
::
VarDesc
*
var_desc
)
...
...
@@ -228,6 +229,10 @@ class VariableScope : public ScopeBase {
return
listener_
;
}
void
SetVarSikpInplace
(
const
std
::
string
&
name
,
bool
skip
);
bool
GetVarSikpInplace
(
int
id
)
const
;
friend
class
VariableScopeListener
;
private:
...
...
paddle/fluid/framework/new_executor/standalone_executor.cc
浏览文件 @
4812eda5
...
...
@@ -68,7 +68,7 @@ paddle::framework::FetchList StandaloneExecutor::Run(
const
std
::
vector
<
std
::
string
>&
fetch_names
)
{
auto
core
=
GetInterpreterCore
(
feed_names
,
fetch_names
,
false
);
VLOG
(
4
)
<<
"StandaloneExecutor: "
<<
this
<<
", InterpreterCore: "
<<
core
;
return
core
->
Run
();
return
core
->
Run
(
feed_names
);
}
framework
::
interpreter
::
CostInfo
StandaloneExecutor
::
DryRun
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录