Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
30a6f9b3
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 2 年 前同步成功
通知
2325
Star
20933
Fork
5424
代码
文件
提交
分支
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看板
提交
30a6f9b3
编写于
1月 19, 2017
作者:
Y
Yu Yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Start doing shared c_api library
上级
88c38623
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
10 addition
and
6 deletion
+10
-6
paddle/capi/CMakeLists.txt
paddle/capi/CMakeLists.txt
+4
-0
paddle/capi/GradientMachine.cpp
paddle/capi/GradientMachine.cpp
+6
-6
未找到文件。
paddle/capi/CMakeLists.txt
浏览文件 @
30a6f9b3
...
@@ -55,6 +55,10 @@ add_custom_target(paddle_capi_whole ALL
...
@@ -55,6 +55,10 @@ add_custom_target(paddle_capi_whole ALL
set_target_properties
(
paddle_capi_whole
set_target_properties
(
paddle_capi_whole
PROPERTIES IMPORTED_LOCATION
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
capi_whole_library
}
)
PROPERTIES IMPORTED_LOCATION
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
capi_whole_library
}
)
add_library
(
paddle_capi_shared SHARED
${
CAPI_SOURCES
}
)
target_include_directories
(
paddle_capi_shared PUBLIC
${
CMAKE_CURRENT_BINARY_DIR
}
)
link_paddle_exe
(
paddle_capi_shared
)
# install library & headers.
# install library & headers.
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
capi_whole_library
}
DESTINATION lib
)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
capi_whole_library
}
DESTINATION lib
)
install
(
FILES
${
CAPI_HEADER
}
DESTINATION include/paddle
)
install
(
FILES
${
CAPI_HEADER
}
DESTINATION include/paddle
)
...
...
paddle/capi/GradientMachine.cpp
浏览文件 @
30a6f9b3
...
@@ -38,7 +38,7 @@ NeuralNetwork* newCustomNerualNetwork(const std::string& name,
...
@@ -38,7 +38,7 @@ NeuralNetwork* newCustomNerualNetwork(const std::string& name,
}
// namespace paddle
}
// namespace paddle
extern
"C"
{
extern
"C"
{
int
PDGradientMachineCreateForPredict
(
PD_Gradie
m
tMachine
*
machine
,
int
PDGradientMachineCreateForPredict
(
PD_Gradie
n
tMachine
*
machine
,
void
*
modelConfigProtobuf
,
void
*
modelConfigProtobuf
,
int
size
)
{
int
size
)
{
if
(
modelConfigProtobuf
==
nullptr
)
return
kPD_NULLPTR
;
if
(
modelConfigProtobuf
==
nullptr
)
return
kPD_NULLPTR
;
...
@@ -55,12 +55,12 @@ int PDGradientMachineCreateForPredict(PD_GradiemtMachine* machine,
...
@@ -55,12 +55,12 @@ int PDGradientMachineCreateForPredict(PD_GradiemtMachine* machine,
return
kPD_NO_ERROR
;
return
kPD_NO_ERROR
;
}
}
int
PDGradientMachineDestroy
(
PD_Gradie
m
tMachine
machine
)
{
int
PDGradientMachineDestroy
(
PD_Gradie
n
tMachine
machine
)
{
delete
cast
(
machine
);
delete
cast
(
machine
);
return
kPD_NO_ERROR
;
return
kPD_NO_ERROR
;
}
}
int
PDGradientMachineLoadParameterFromDisk
(
PD_Gradie
m
tMachine
machine
,
int
PDGradientMachineLoadParameterFromDisk
(
PD_Gradie
n
tMachine
machine
,
const
char
*
path
)
{
const
char
*
path
)
{
auto
m
=
cast
(
machine
);
auto
m
=
cast
(
machine
);
if
(
m
==
nullptr
||
path
==
nullptr
||
m
->
machine
==
nullptr
)
if
(
m
==
nullptr
||
path
==
nullptr
||
m
->
machine
==
nullptr
)
...
@@ -69,7 +69,7 @@ int PDGradientMachineLoadParameterFromDisk(PD_GradiemtMachine machine,
...
@@ -69,7 +69,7 @@ int PDGradientMachineLoadParameterFromDisk(PD_GradiemtMachine machine,
return
kPD_NO_ERROR
;
return
kPD_NO_ERROR
;
}
}
int
PDGradientMachineForward
(
PD_Gradie
m
tMachine
machine
,
int
PDGradientMachineForward
(
PD_Gradie
n
tMachine
machine
,
PD_Arguments
inArgs
,
PD_Arguments
inArgs
,
PD_Arguments
outArgs
,
PD_Arguments
outArgs
,
bool
isTrain
)
{
bool
isTrain
)
{
...
@@ -83,10 +83,10 @@ int PDGradientMachineForward(PD_GradiemtMachine machine,
...
@@ -83,10 +83,10 @@ int PDGradientMachineForward(PD_GradiemtMachine machine,
return
kPD_NO_ERROR
;
return
kPD_NO_ERROR
;
}
}
int
PDGradientMachineCreateSharedParam
(
PD_Gradie
m
tMachine
origin
,
int
PDGradientMachineCreateSharedParam
(
PD_Gradie
n
tMachine
origin
,
void
*
modelConfigProtobuf
,
void
*
modelConfigProtobuf
,
int
size
,
int
size
,
PD_Gradie
m
tMachine
*
slave
)
{
PD_Gradie
n
tMachine
*
slave
)
{
auto
o
=
cast
(
origin
);
auto
o
=
cast
(
origin
);
if
(
origin
==
nullptr
||
slave
==
nullptr
||
o
->
machine
==
nullptr
)
{
if
(
origin
==
nullptr
||
slave
==
nullptr
||
o
->
machine
==
nullptr
)
{
return
kPD_NULLPTR
;
return
kPD_NULLPTR
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录