Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
449bdde5
P
Paddle
项目概览
机器未来
/
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看板
提交
449bdde5
编写于
4月 12, 2018
作者:
L
Liu Yiqun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Correct some typos.
上级
2762959f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
17 addition
and
11 deletion
+17
-11
cmake/cblas.cmake
cmake/cblas.cmake
+1
-1
paddle/fluid/framework/executor.cc
paddle/fluid/framework/executor.cc
+11
-8
paddle/fluid/framework/executor.h
paddle/fluid/framework/executor.h
+3
-0
paddle/fluid/inference/io.cc
paddle/fluid/inference/io.cc
+1
-1
paddle/fluid/inference/tests/test_helper.h
paddle/fluid/inference/tests/test_helper.h
+1
-1
未找到文件。
cmake/cblas.cmake
浏览文件 @
449bdde5
...
...
@@ -78,7 +78,7 @@ if(NOT CMAKE_CROSSCOMPILING)
/usr/lib/reference/
)
else
()
# Diable the finding of reference cblas under host's system path
# Di
s
able the finding of reference cblas under host's system path
set
(
REFERENCE_CBLAS_INCLUDE_SEARCH_PATHS
${
REFERENCE_CBLAS_ROOT
}
/include
)
set
(
REFERENCE_CBLAS_LIB_SEARCH_PATHS
${
REFERENCE_CBLAS_ROOT
}
/lib
)
endif
()
...
...
paddle/fluid/framework/executor.cc
浏览文件 @
449bdde5
...
...
@@ -83,8 +83,8 @@ static void CheckTensorNANOrInf(const std::string& name,
if
(
tensor
.
memory_size
()
==
0
)
{
return
;
}
if
(
tensor
.
type
().
hash_code
()
!=
typeid
(
float
).
hash_code
()
&&
tensor
.
type
().
hash_code
()
!=
typeid
(
double
).
hash_code
())
{
if
(
tensor
.
type
().
hash_code
()
!=
typeid
(
float
).
hash_code
()
&&
// NOLINT
tensor
.
type
().
hash_code
()
!=
typeid
(
double
).
hash_code
())
{
// NOLINT
return
;
}
PADDLE_ENFORCE
(
!
framework
::
TensorContainsInf
(
tensor
),
...
...
@@ -145,12 +145,13 @@ void Executor::Run(const ProgramDesc& pdesc, Scope* scope, int block_id,
// Return true if the block has feed operators and holder of matching info.
static
bool
has_feed_operators
(
const
BlockDesc
&
block
,
std
::
map
<
std
::
string
,
const
LoDTensor
*>&
feed_targets
,
const
std
::
map
<
std
::
string
,
const
LoDTensor
*>&
feed_targets
,
const
std
::
string
&
feed_holder_name
)
{
size_t
feed_count
=
0
;
for
(
auto
*
op
:
block
.
AllOps
())
{
if
(
op
->
Type
()
==
kFeedOpType
)
{
feed_count
++
;
// The input variable's name of feed_op should be feed_holder_name.
PADDLE_ENFORCE_EQ
(
op
->
Input
(
"X"
)[
0
],
feed_holder_name
,
"Input to feed op should be '%s'"
,
feed_holder_name
);
std
::
string
feed_target_name
=
op
->
Output
(
"Out"
)[
0
];
...
...
@@ -167,7 +168,7 @@ static bool has_feed_operators(
"The number of feed operators should match 'feed_targets'"
);
if
(
!
feed_holder_name
.
empty
())
{
// When feed operator are present, so should be feed_holder
// When feed operator are present, so should be feed_holder
.
auto
var
=
block
.
FindVar
(
feed_holder_name
);
PADDLE_ENFORCE_NOT_NULL
(
var
,
"Block should already have a '%s' variable"
,
feed_holder_name
);
...
...
@@ -187,12 +188,14 @@ static bool has_feed_operators(
// and fetch_holder_name. Raise exception when any mismatch is found.
// Return true if the block has fetch operators and holder of matching info.
static
bool
has_fetch_operators
(
const
BlockDesc
&
block
,
std
::
map
<
std
::
string
,
LoDTensor
*>&
fetch_targets
,
const
BlockDesc
&
block
,
const
std
::
map
<
std
::
string
,
LoDTensor
*>&
fetch_targets
,
const
std
::
string
&
fetch_holder_name
)
{
size_t
fetch_count
=
0
;
for
(
auto
*
op
:
block
.
AllOps
())
{
if
(
op
->
Type
()
==
kFetchOpType
)
{
fetch_count
++
;
// The output variable's name of fetch_op should be fetch_holder_name.
PADDLE_ENFORCE_EQ
(
op
->
Output
(
"Out"
)[
0
],
fetch_holder_name
,
"Output of fetch op should be '%s'"
,
fetch_holder_name
);
std
::
string
fetch_target_name
=
op
->
Input
(
"X"
)[
0
];
...
...
@@ -209,7 +212,7 @@ static bool has_fetch_operators(
"The number of fetch operators should match 'fetch_targets'"
);
if
(
!
fetch_holder_name
.
empty
())
{
// When fetch operator are present, so should be fetch_holder
// When fetch operator are present, so should be fetch_holder
.
auto
var
=
block
.
FindVar
(
fetch_holder_name
);
PADDLE_ENFORCE_NOT_NULL
(
var
,
"Block should already have a '%s' variable"
,
fetch_holder_name
);
...
...
@@ -287,8 +290,8 @@ void Executor::Run(const ProgramDesc& program, Scope* scope,
}
auto
ctx
=
Prepare
(
*
copy_program
,
0
);
RunPreparedContext
(
ctx
.
get
(),
scope
,
feed_targets
,
fetch_targets
,
feed_holder_name
,
fetch_holder_name
,
create_vars
);
RunPreparedContext
(
ctx
.
get
(),
scope
,
feed_targets
,
fetch_targets
,
create_vars
,
feed_holder_name
,
fetch_holder_name
);
}
std
::
unique_ptr
<
ExecutorPrepareContext
>
Executor
::
Prepare
(
...
...
paddle/fluid/framework/executor.h
浏览文件 @
449bdde5
...
...
@@ -14,6 +14,9 @@ limitations under the License. */
#pragma once
#include <map>
#include <string>
#include <vector>
#include "paddle/fluid/framework/op_info.h"
#include "paddle/fluid/framework/program_desc.h"
#include "paddle/fluid/framework/scope.h"
...
...
paddle/fluid/inference/io.cc
浏览文件 @
449bdde5
...
...
@@ -23,7 +23,7 @@ limitations under the License. */
namespace
paddle
{
namespace
inference
{
// Temporaril
l
y add this function for exposing framework::InitDevices() when
// Temporarily add this function for exposing framework::InitDevices() when
// linking the inference shared library.
void
Init
(
bool
init_p2p
)
{
framework
::
InitDevices
(
init_p2p
);
}
...
...
paddle/fluid/inference/tests/test_helper.h
浏览文件 @
449bdde5
...
...
@@ -195,7 +195,7 @@ void TestInference(const std::string& dirname,
paddle
::
platform
::
DeviceContextPool
::
Instance
().
Get
(
place
));
if
(
PrepareContext
)
{
// Note: if you change
d
the inference_program, you need to call
// 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
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录