提交 91927cc3 编写于 作者: Y Yu Yang

Change name conventions.

上级 28c4cee5
......@@ -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);
......
......@@ -46,13 +46,13 @@ PD_API paddle_arguments paddle_arguments_create_none();
PD_API paddle_error paddle_arguments_destroy(paddle_arguments args);
/**
* @brief PDArgsGetSize Get size of arguments array
* @brief paddle_arguments_get_size 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
}
......
......@@ -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));
......
......@@ -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));
......
......@@ -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;
......
......@@ -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));
......
......@@ -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,
......
......@@ -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.
先完成此消息的编辑!
想要评论请 注册