Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
488a2dd2
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
488a2dd2
编写于
8月 25, 2018
作者:
D
dzhwinter
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
with ir node
上级
c7e0ed83
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
53 addition
and
29 deletion
+53
-29
paddle/fluid/inference/analysis/argument.h
paddle/fluid/inference/analysis/argument.h
+1
-1
paddle/fluid/inference/analysis/helper.h
paddle/fluid/inference/analysis/helper.h
+1
-25
paddle/fluid/operators/CMakeLists.txt
paddle/fluid/operators/CMakeLists.txt
+2
-0
paddle/fluid/platform/port.h
paddle/fluid/platform/port.h
+49
-3
未找到文件。
paddle/fluid/inference/analysis/argument.h
浏览文件 @
488a2dd2
...
...
@@ -26,6 +26,7 @@
#include <string>
#include "paddle/fluid/framework/program_desc.h"
#include "paddle/fluid/inference/analysis/data_flow_graph.h"
#include "paddle/fluid/platform/enforce.h"
namespace
paddle
{
namespace
inference
{
...
...
@@ -60,7 +61,6 @@ struct Argument {
std
::
unique_ptr
<
std
::
string
>
model_output_store_path
;
};
#define UNLIKELY(condition) __builtin_expect(static_cast<bool>(condition), 0)
#define ANALYSIS_ARGUMENT_CHECK_FIELD(field__) \
if (UNLIKELY(!(field__))) { \
LOG(ERROR) << "field " << #field__ << " should be set."; \
...
...
paddle/fluid/inference/analysis/helper.h
浏览文件 @
488a2dd2
...
...
@@ -14,7 +14,6 @@ limitations under the License. */
#pragma once
#include <sys/stat.h>
#include <cstdio>
#include <fstream>
#include <string>
...
...
@@ -26,6 +25,7 @@ limitations under the License. */
#include "paddle/fluid/framework/scope.h"
#include "paddle/fluid/framework/variable.h"
#include "paddle/fluid/platform/enforce.h"
#include "paddle/fluid/platform/port.h"
namespace
paddle
{
namespace
inference
{
...
...
@@ -124,20 +124,6 @@ T &GetFromScope(const framework::Scope &scope, const std::string &name) {
return
*
var
->
GetMutable
<
T
>
();
}
static
void
ExecShellCommand
(
const
std
::
string
&
cmd
,
std
::
string
*
message
)
{
char
buffer
[
128
];
std
::
shared_ptr
<
FILE
>
pipe
(
popen
(
cmd
.
c_str
(),
"r"
),
pclose
);
if
(
!
pipe
)
{
LOG
(
ERROR
)
<<
"error running command: "
<<
cmd
;
return
;
}
while
(
!
feof
(
pipe
.
get
()))
{
if
(
fgets
(
buffer
,
128
,
pipe
.
get
())
!=
nullptr
)
{
*
message
+=
buffer
;
}
}
}
static
framework
::
proto
::
ProgramDesc
LoadProgramDesc
(
const
std
::
string
&
model_path
)
{
std
::
ifstream
fin
(
model_path
,
std
::
ios
::
in
|
std
::
ios
::
binary
);
...
...
@@ -159,16 +145,6 @@ static bool FileExists(const std::string &filepath) {
return
exists
;
}
static
bool
PathExists
(
const
std
::
string
&
path
)
{
struct
stat
statbuf
;
if
(
stat
(
path
.
c_str
(),
&
statbuf
)
!=
-
1
)
{
if
(
S_ISDIR
(
statbuf
.
st_mode
))
{
return
true
;
}
}
return
false
;
}
}
// namespace analysis
}
// namespace inference
}
// namespace paddle
...
...
paddle/fluid/operators/CMakeLists.txt
浏览文件 @
488a2dd2
...
...
@@ -307,10 +307,12 @@ op_library(save_combine_op DEPS lod_tensor)
op_library
(
load_combine_op DEPS lod_tensor
)
op_library
(
concat_op DEPS concat
)
if
(
NOT WIN32
)
# FIXME(thuan): Move CSP operators to paddle/fluid/framework/operators/concurrency
add_subdirectory
(
concurrency
)
op_library
(
channel_send_op DEPS concurrency
)
op_library
(
channel_recv_op DEPS concurrency
)
endif
(
NOT WIN32
)
list
(
REMOVE_ITEM GENERAL_OPS
${
DEPS_OPS
}
)
...
...
paddle/fluid/platform/port.h
浏览文件 @
488a2dd2
...
...
@@ -14,15 +14,22 @@
#pragma once
#include <cstdio>
#include <stdexcept>
#include <string>
#if !defined(_WIN32)
#include <dlfcn.h> // for dladdr
#include <execinfo.h> // for backtrace
#include <sys/stat.h>
#else
#include <Shlwapi.h>
#include <Windows.h>
#include <io.h> // _popen, _pclose
#include <windows.h>
#ifndef S_ISDIR // windows port for sys/stat.h
#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
#endif
static
void
*
dlsym
(
void
*
handle
,
const
char
*
symbol_name
)
{
FARPROC
found_symbol
;
...
...
@@ -34,4 +41,43 @@ static void* dlsym(void* handle, const char* symbol_name) {
return
reinterpret_cast
<
void
*>
(
found_symbol
);
}
#endif
#endif // !_WIN32
static
void
ExecShellCommand
(
const
std
::
string
&
cmd
,
std
::
string
*
message
)
{
char
buffer
[
128
];
#if !defined(_WIN32)
std
::
shared_ptr
<
FILE
>
pipe
(
popen
(
cmd
.
c_str
(),
"r"
),
pclose
);
#else
std
::
shared_ptr
<
FILE
>
pipe
(
_popen
(
cmd
.
c_str
(),
"r"
),
_pclose
);
#endif // _WIN32
if
(
!
pipe
)
{
LOG
(
ERROR
)
<<
"error running command: "
<<
cmd
;
return
;
}
while
(
!
feof
(
pipe
.
get
()))
{
if
(
fgets
(
buffer
,
128
,
pipe
.
get
())
!=
nullptr
)
{
*
message
+=
buffer
;
}
}
}
static
bool
PathExists
(
const
std
::
string
&
path
)
{
#if !defined(_WIN32)
struct
stat
statbuf
;
if
(
stat
(
path
.
c_str
(),
&
statbuf
)
!=
-
1
)
{
if
(
S_ISDIR
(
statbuf
.
st_mode
))
{
return
true
;
}
}
#else
struct
_stat
statbuf
;
if
(
_stat
(
path
.
c_str
(),
&
statbuf
)
!=
-
1
)
{
if
(
S_ISDIR
(
statbuf
.
st_mode
))
{
return
true
;
}
}
#endif // !_WIN32
return
false
;
}
static
FILE
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录