Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
91927cc3
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看板
提交
91927cc3
编写于
4月 20, 2017
作者:
Y
Yu Yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change name conventions.
上级
28c4cee5
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
35 addition
and
34 deletion
+35
-34
paddle/capi/Arguments.cpp
paddle/capi/Arguments.cpp
+11
-11
paddle/capi/arguments.h
paddle/capi/arguments.h
+14
-13
paddle/capi/examples/model_inference/dense/main.c
paddle/capi/examples/model_inference/dense/main.c
+1
-1
paddle/capi/examples/model_inference/multi_thread/main.c
paddle/capi/examples/model_inference/multi_thread/main.c
+1
-1
paddle/capi/examples/model_inference/sequence/main.c
paddle/capi/examples/model_inference/sequence/main.c
+1
-1
paddle/capi/examples/model_inference/sparse_binary/main.c
paddle/capi/examples/model_inference/sparse_binary/main.c
+1
-1
paddle/capi/tests/test_Arguments.cpp
paddle/capi/tests/test_Arguments.cpp
+4
-4
paddle/capi/tests/test_GradientMachine.cpp
paddle/capi/tests/test_GradientMachine.cpp
+2
-2
未找到文件。
paddle/capi/Arguments.cpp
浏览文件 @
91927cc3
...
...
@@ -31,7 +31,7 @@ paddle_error paddle_arguments_destroy(paddle_arguments args) {
return
kPD_NO_ERROR
;
}
paddle_error
paddle_arguments_size
(
paddle_arguments
args
,
uint64_t
*
size
)
{
paddle_error
paddle_arguments_
get_
size
(
paddle_arguments
args
,
uint64_t
*
size
)
{
if
(
args
==
nullptr
||
size
==
nullptr
)
return
kPD_NULLPTR
;
*
size
=
castArg
(
args
)
->
args
.
size
();
return
kPD_NO_ERROR
;
...
...
@@ -55,9 +55,9 @@ paddle_error paddle_arguments_set_value(paddle_arguments args,
return
kPD_NO_ERROR
;
}
paddle_error
paddle_arguments_value
(
paddle_arguments
args
,
uint64_t
ID
,
paddle_matrix
mat
)
{
paddle_error
paddle_arguments_
get_
value
(
paddle_arguments
args
,
uint64_t
ID
,
paddle_matrix
mat
)
{
if
(
args
==
nullptr
||
mat
==
nullptr
)
return
kPD_NULLPTR
;
auto
m
=
paddle
::
capi
::
cast
<
paddle
::
capi
::
CMatrix
>
(
mat
);
auto
a
=
castArg
(
args
);
...
...
@@ -66,9 +66,9 @@ paddle_error paddle_arguments_value(paddle_arguments args,
return
kPD_NO_ERROR
;
}
paddle_error
paddle_arguments_ids
(
paddle_arguments
args
,
uint64_t
ID
,
paddle_ivector
ids
)
{
paddle_error
paddle_arguments_
get_
ids
(
paddle_arguments
args
,
uint64_t
ID
,
paddle_ivector
ids
)
{
if
(
args
==
nullptr
||
ids
==
nullptr
)
return
kPD_NULLPTR
;
auto
iv
=
castIVec
(
ids
);
auto
a
=
castArg
(
args
);
...
...
@@ -103,10 +103,10 @@ paddle_error paddle_arguments_set_sequence_start_pos(paddle_arguments args,
});
}
paddle_error
paddle_arguments_sequence_start_pos
(
paddle_arguments
args
,
uint64_t
ID
,
uint32_t
nestedLevel
,
paddle_ivector
seqPos
)
{
paddle_error
paddle_arguments_
get_
sequence_start_pos
(
paddle_arguments
args
,
uint64_t
ID
,
uint32_t
nestedLevel
,
paddle_ivector
seqPos
)
{
if
(
args
==
nullptr
||
seqPos
==
nullptr
)
return
kPD_NULLPTR
;
auto
iv
=
paddle
::
capi
::
cast
<
paddle
::
capi
::
CIVector
>
(
seqPos
);
auto
a
=
castArg
(
args
);
...
...
paddle/capi/arguments.h
浏览文件 @
91927cc3
...
...
@@ -46,13 +46,13 @@ PD_API paddle_arguments paddle_arguments_create_none();
PD_API
paddle_error
paddle_arguments_destroy
(
paddle_arguments
args
);
/**
* @brief
PDArgsGetS
ize Get size of arguments array
* @brief
paddle_arguments_get_s
ize Get size of arguments array
* @param [in] args arguments array
* @param [out] size array size
* @return paddle_error
*/
PD_API
paddle_error
paddle_arguments_size
(
paddle_arguments
args
,
uint64_t
*
size
);
PD_API
paddle_error
paddle_arguments_
get_
size
(
paddle_arguments
args
,
uint64_t
*
size
);
/**
* @brief PDArgsResize Resize a arguments array.
...
...
@@ -83,9 +83,9 @@ PD_API paddle_error paddle_arguments_set_value(paddle_arguments args,
* @param [out] mat matrix pointer
* @return paddle_error
*/
PD_API
paddle_error
paddle_arguments_value
(
paddle_arguments
args
,
uint64_t
ID
,
paddle_matrix
mat
);
PD_API
paddle_error
paddle_arguments_
get_
value
(
paddle_arguments
args
,
uint64_t
ID
,
paddle_matrix
mat
);
/**
* @brief PDArgsGetIds Get the integer vector of one argument in array, which
...
...
@@ -95,9 +95,9 @@ PD_API paddle_error paddle_arguments_value(paddle_arguments args,
* @param ids integer vector pointer
* @return paddle_error
*/
PD_API
paddle_error
paddle_arguments_ids
(
paddle_arguments
args
,
uint64_t
ID
,
paddle_ivector
ids
);
PD_API
paddle_error
paddle_arguments_
get_
ids
(
paddle_arguments
args
,
uint64_t
ID
,
paddle_ivector
ids
);
/**
* @brief PDArgsSetIds Set the integer vector of one argument in array, which
...
...
@@ -132,10 +132,11 @@ paddle_arguments_set_sequence_start_pos(paddle_arguments args,
* @param [out] seqPos sequence position array
* @return paddle_error
*/
PD_API
paddle_error
paddle_arguments_sequence_start_pos
(
paddle_arguments
args
,
uint64_t
ID
,
uint32_t
nestedLevel
,
paddle_ivector
seqPos
);
PD_API
paddle_error
paddle_arguments_get_sequence_start_pos
(
paddle_arguments
args
,
uint64_t
ID
,
uint32_t
nestedLevel
,
paddle_ivector
seqPos
);
#ifdef __cplusplus
}
...
...
paddle/capi/examples/model_inference/dense/main.c
浏览文件 @
91927cc3
...
...
@@ -49,7 +49,7 @@ int main() {
/* isTrain */
false
));
paddle_matrix
prob
=
paddle_matrix_create_none
();
CHECK
(
paddle_arguments_value
(
out_args
,
0
,
prob
));
CHECK
(
paddle_arguments_
get_
value
(
out_args
,
0
,
prob
));
CHECK
(
paddle_matrix_get_row
(
prob
,
0
,
&
array
));
...
...
paddle/capi/examples/model_inference/multi_thread/main.c
浏览文件 @
91927cc3
...
...
@@ -38,7 +38,7 @@ void* thread_main(void* gm_ptr) {
out_args
,
/* isTrain */
false
));
CHECK
(
paddle_arguments_value
(
out_args
,
0
,
prob
));
CHECK
(
paddle_arguments_
get_
value
(
out_args
,
0
,
prob
));
CHECK
(
paddle_matrix_get_row
(
prob
,
0
,
&
array
));
...
...
paddle/capi/examples/model_inference/sequence/main.c
浏览文件 @
91927cc3
...
...
@@ -47,7 +47,7 @@ int main() {
/* isTrain */
false
));
paddle_matrix
prob
=
paddle_matrix_create_none
();
CHECK
(
paddle_arguments_value
(
out_args
,
0
,
prob
));
CHECK
(
paddle_arguments_
get_
value
(
out_args
,
0
,
prob
));
paddle_real
*
array
;
...
...
paddle/capi/examples/model_inference/sparse_binary/main.c
浏览文件 @
91927cc3
...
...
@@ -50,7 +50,7 @@ int main() {
/* isTrain */
false
));
paddle_matrix
prob
=
paddle_matrix_create_none
();
CHECK
(
paddle_arguments_value
(
out_args
,
0
,
prob
));
CHECK
(
paddle_arguments_
get_
value
(
out_args
,
0
,
prob
));
CHECK
(
paddle_matrix_get_row
(
prob
,
0
,
&
array
));
...
...
paddle/capi/tests/test_Arguments.cpp
浏览文件 @
91927cc3
...
...
@@ -32,7 +32,7 @@ TEST(CAPIArguments, create) {
//! TODO(yuyang18): Test GPU Code.
paddle_arguments
args
=
paddle_arguments_create_none
();
uint64_t
size
;
ASSERT_EQ
(
kPD_NO_ERROR
,
paddle_arguments_size
(
args
,
&
size
));
ASSERT_EQ
(
kPD_NO_ERROR
,
paddle_arguments_
get_
size
(
args
,
&
size
));
ASSERT_EQ
(
0UL
,
size
);
ASSERT_EQ
(
kPD_NO_ERROR
,
paddle_arguments_destroy
(
args
));
}
...
...
@@ -50,7 +50,7 @@ TEST(CAPIArguments, value) {
paddle_matrix
val
=
paddle_matrix_create_none
();
ASSERT_EQ
(
kPD_NO_ERROR
,
paddle_arguments_value
(
args
,
0
,
val
));
ASSERT_EQ
(
kPD_NO_ERROR
,
paddle_arguments_
get_
value
(
args
,
0
,
val
));
for
(
size_t
i
=
0
;
i
<
128
;
++
i
)
{
paddle_real
*
row1
;
...
...
@@ -78,7 +78,7 @@ TEST(CAPIArguments, ids) {
ASSERT_EQ
(
kPD_NO_ERROR
,
paddle_arguments_set_ids
(
args
,
0
,
ivec
));
paddle_ivector
val
=
paddle_ivector_create_none
();
ASSERT_EQ
(
kPD_NO_ERROR
,
paddle_arguments_ids
(
args
,
0
,
val
));
ASSERT_EQ
(
kPD_NO_ERROR
,
paddle_arguments_
get_
ids
(
args
,
0
,
val
));
ASSERT_EQ
(
kPD_NO_ERROR
,
paddle_ivector_destroy
(
ivec
));
ASSERT_EQ
(
kPD_NO_ERROR
,
paddle_ivector_destroy
(
val
));
ASSERT_EQ
(
kPD_NO_ERROR
,
paddle_arguments_destroy
(
args
));
...
...
@@ -117,7 +117,7 @@ TEST(CAPIArguments, Sequence) {
std
::
placeholders
::
_2
,
nestedLevel
,
std
::
placeholders
::
_3
),
std
::
bind
(
paddle_arguments_sequence_start_pos
,
std
::
bind
(
paddle_arguments_
get_
sequence_start_pos
,
std
::
placeholders
::
_1
,
std
::
placeholders
::
_2
,
nestedLevel
,
...
...
paddle/capi/tests/test_GradientMachine.cpp
浏览文件 @
91927cc3
...
...
@@ -73,10 +73,10 @@ TEST(GradientMachine, testPredict) {
paddle_gradient_machine_forward
(
machine
,
inArgs
,
outArgs
,
false
));
uint64_t
sz
;
ASSERT_EQ
(
kPD_NO_ERROR
,
paddle_arguments_size
(
outArgs
,
&
sz
));
ASSERT_EQ
(
kPD_NO_ERROR
,
paddle_arguments_
get_
size
(
outArgs
,
&
sz
));
ASSERT_EQ
(
1UL
,
sz
);
ASSERT_EQ
(
kPD_NO_ERROR
,
paddle_arguments_value
(
outArgs
,
0
,
mat
));
ASSERT_EQ
(
kPD_NO_ERROR
,
paddle_arguments_
get_
value
(
outArgs
,
0
,
mat
));
std
::
vector
<
paddle
::
Argument
>
paddleInArgs
;
std
::
vector
<
paddle
::
Argument
>
paddleOutArgs
;
paddleInArgs
.
resize
(
1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录