Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
4c8ff726
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看板
未验证
提交
4c8ff726
编写于
4月 25, 2018
作者:
A
Abhinav Arora
提交者:
GitHub
4月 25, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix CPPLint errors with rxecutor (#10212)
上级
5fe1fe3a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
23 deletion
+23
-23
paddle/fluid/framework/executor.cc
paddle/fluid/framework/executor.cc
+13
-13
paddle/fluid/framework/executor.h
paddle/fluid/framework/executor.h
+4
-4
paddle/fluid/inference/tests/test_helper.h
paddle/fluid/inference/tests/test_helper.h
+6
-6
未找到文件。
paddle/fluid/framework/executor.cc
浏览文件 @
4c8ff726
...
...
@@ -226,15 +226,15 @@ static bool has_fetch_operators(
}
void
Executor
::
Run
(
const
ProgramDesc
&
program
,
Scope
*
scope
,
std
::
map
<
std
::
string
,
const
LoDTensor
*>
&
feed_targets
,
std
::
map
<
std
::
string
,
LoDTensor
*>
&
fetch_targets
,
std
::
map
<
std
::
string
,
const
LoDTensor
*>
*
feed_targets
,
std
::
map
<
std
::
string
,
LoDTensor
*>
*
fetch_targets
,
bool
create_vars
,
const
std
::
string
&
feed_holder_name
,
const
std
::
string
&
fetch_holder_name
)
{
platform
::
RecordBlock
b
(
kProgramId
);
bool
has_feed_ops
=
has_feed_operators
(
program
.
Block
(
0
),
feed_targets
,
feed_holder_name
);
has_feed_operators
(
program
.
Block
(
0
),
*
feed_targets
,
feed_holder_name
);
bool
has_fetch_ops
=
has_fetch_operators
(
program
.
Block
(
0
),
fetch_targets
,
fetch_holder_name
);
has_fetch_operators
(
program
.
Block
(
0
),
*
fetch_targets
,
fetch_holder_name
);
ProgramDesc
*
copy_program
=
const_cast
<
ProgramDesc
*>
(
&
program
);
if
(
!
has_feed_ops
||
!
has_fetch_ops
)
{
...
...
@@ -250,7 +250,7 @@ void Executor::Run(const ProgramDesc& program, Scope* scope,
feed_holder
->
SetPersistable
(
true
);
int
i
=
0
;
for
(
auto
&
feed_target
:
feed_targets
)
{
for
(
auto
&
feed_target
:
(
*
feed_targets
)
)
{
std
::
string
var_name
=
feed_target
.
first
;
VLOG
(
3
)
<<
"feed target's name: "
<<
var_name
;
...
...
@@ -273,7 +273,7 @@ void Executor::Run(const ProgramDesc& program, Scope* scope,
fetch_holder
->
SetPersistable
(
true
);
int
i
=
0
;
for
(
auto
&
fetch_target
:
fetch_targets
)
{
for
(
auto
&
fetch_target
:
(
*
fetch_targets
)
)
{
std
::
string
var_name
=
fetch_target
.
first
;
VLOG
(
3
)
<<
"fetch target's name: "
<<
var_name
;
...
...
@@ -361,16 +361,16 @@ void Executor::RunPreparedContext(ExecutorPrepareContext* ctx, Scope* scope,
void
Executor
::
RunPreparedContext
(
ExecutorPrepareContext
*
ctx
,
Scope
*
scope
,
std
::
map
<
std
::
string
,
const
LoDTensor
*>
&
feed_targets
,
std
::
map
<
std
::
string
,
LoDTensor
*>
&
fetch_targets
,
bool
create_vars
,
std
::
map
<
std
::
string
,
const
LoDTensor
*>
*
feed_targets
,
std
::
map
<
std
::
string
,
LoDTensor
*>
*
fetch_targets
,
bool
create_vars
,
const
std
::
string
&
feed_holder_name
,
const
std
::
string
&
fetch_holder_name
)
{
auto
&
global_block
=
ctx
->
prog_
.
Block
(
ctx
->
block_id_
);
PADDLE_ENFORCE
(
has_feed_operators
(
global_block
,
feed_targets
,
feed_holder_name
),
has_feed_operators
(
global_block
,
*
feed_targets
,
feed_holder_name
),
"Program in ExecutorPrepareContext should has feed_ops."
);
PADDLE_ENFORCE
(
has_fetch_operators
(
global_block
,
fetch_targets
,
fetch_holder_name
),
has_fetch_operators
(
global_block
,
*
fetch_targets
,
fetch_holder_name
),
"Program in the prepared context should has fetch_ops."
);
// map the data of feed_targets to feed_holder
...
...
@@ -378,8 +378,8 @@ void Executor::RunPreparedContext(
if
(
op
->
Type
()
==
kFeedOpType
)
{
std
::
string
feed_target_name
=
op
->
Output
(
"Out"
)[
0
];
int
idx
=
boost
::
get
<
int
>
(
op
->
GetAttr
(
"col"
));
SetFeedVariable
(
scope
,
*
feed_targets
[
feed_target_name
],
feed_holder_name
,
idx
);
SetFeedVariable
(
scope
,
*
(
*
feed_targets
)[
feed_target_name
]
,
feed_holder_name
,
idx
);
}
}
...
...
@@ -390,7 +390,7 @@ void Executor::RunPreparedContext(
if
(
op
->
Type
()
==
kFetchOpType
)
{
std
::
string
fetch_target_name
=
op
->
Input
(
"X"
)[
0
];
int
idx
=
boost
::
get
<
int
>
(
op
->
GetAttr
(
"col"
));
*
fetch_targets
[
fetch_target_name
]
=
*
(
*
fetch_targets
)
[
fetch_target_name
]
=
GetFetchVariable
(
*
scope
,
fetch_holder_name
,
idx
);
}
}
...
...
paddle/fluid/framework/executor.h
浏览文件 @
4c8ff726
...
...
@@ -55,8 +55,8 @@ class Executor {
bool
create_local_scope
=
true
,
bool
create_vars
=
true
);
void
Run
(
const
ProgramDesc
&
program
,
Scope
*
scope
,
std
::
map
<
std
::
string
,
const
LoDTensor
*>
&
feed_targets
,
std
::
map
<
std
::
string
,
LoDTensor
*>
&
fetch_targets
,
std
::
map
<
std
::
string
,
const
LoDTensor
*>
*
feed_targets
,
std
::
map
<
std
::
string
,
LoDTensor
*>
*
fetch_targets
,
bool
create_vars
=
true
,
const
std
::
string
&
feed_holder_name
=
"feed"
,
const
std
::
string
&
fetch_holder_name
=
"fetch"
);
...
...
@@ -74,8 +74,8 @@ class Executor {
bool
create_vars
=
true
);
void
RunPreparedContext
(
ExecutorPrepareContext
*
ctx
,
Scope
*
scope
,
std
::
map
<
std
::
string
,
const
LoDTensor
*>
&
feed_targets
,
std
::
map
<
std
::
string
,
LoDTensor
*>
&
fetch_targets
,
std
::
map
<
std
::
string
,
const
LoDTensor
*>
*
feed_targets
,
std
::
map
<
std
::
string
,
LoDTensor
*>
*
fetch_targets
,
bool
create_vars
=
true
,
const
std
::
string
&
feed_holder_name
=
"feed"
,
const
std
::
string
&
fetch_holder_name
=
"fetch"
);
...
...
paddle/fluid/inference/tests/test_helper.h
浏览文件 @
4c8ff726
...
...
@@ -178,10 +178,10 @@ void TestInference(const std::string& dirname,
std
::
unique_ptr
<
paddle
::
framework
::
ExecutorPrepareContext
>
ctx
;
if
(
PrepareContext
)
{
ctx
=
executor
.
Prepare
(
*
inference_program
,
0
);
executor
.
RunPreparedContext
(
ctx
.
get
(),
scope
,
feed_targets
,
fetch
_targets
,
CreateVars
);
executor
.
RunPreparedContext
(
ctx
.
get
(),
scope
,
&
feed
_targets
,
&
fetch_targets
,
CreateVars
);
}
else
{
executor
.
Run
(
*
inference_program
,
scope
,
feed_targets
,
fetch_targets
,
executor
.
Run
(
*
inference_program
,
scope
,
&
feed_targets
,
&
fetch_targets
,
CreateVars
);
}
...
...
@@ -197,10 +197,10 @@ void TestInference(const std::string& dirname,
if
(
PrepareContext
)
{
// Note: if you change the inference_program, you need to call
// executor.Prepare() again to get a new ExecutorPrepareContext.
executor
.
RunPreparedContext
(
ctx
.
get
(),
scope
,
feed_targets
,
fetch_targets
,
CreateVars
);
executor
.
RunPreparedContext
(
ctx
.
get
(),
scope
,
&
feed_targets
,
&
fetch_targets
,
CreateVars
);
}
else
{
executor
.
Run
(
*
inference_program
,
scope
,
feed_targets
,
fetch_targets
,
executor
.
Run
(
*
inference_program
,
scope
,
&
feed_targets
,
&
fetch_targets
,
CreateVars
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录