From 91927cc3a20ef805a1fb7dafc7d71a014daade27 Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Thu, 20 Apr 2017 21:28:05 +0800 Subject: [PATCH] Change name conventions. --- paddle/capi/Arguments.cpp | 22 +++++++-------- paddle/capi/arguments.h | 27 ++++++++++--------- .../examples/model_inference/dense/main.c | 2 +- .../model_inference/multi_thread/main.c | 2 +- .../examples/model_inference/sequence/main.c | 2 +- .../model_inference/sparse_binary/main.c | 2 +- paddle/capi/tests/test_Arguments.cpp | 8 +++--- paddle/capi/tests/test_GradientMachine.cpp | 4 +-- 8 files changed, 35 insertions(+), 34 deletions(-) diff --git a/paddle/capi/Arguments.cpp b/paddle/capi/Arguments.cpp index 2954f522c9..8b81ec69e6 100644 --- a/paddle/capi/Arguments.cpp +++ b/paddle/capi/Arguments.cpp @@ -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(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(seqPos); auto a = castArg(args); diff --git a/paddle/capi/arguments.h b/paddle/capi/arguments.h index 1bb6516ea0..d71ea26a5d 100644 --- a/paddle/capi/arguments.h +++ b/paddle/capi/arguments.h @@ -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 } diff --git a/paddle/capi/examples/model_inference/dense/main.c b/paddle/capi/examples/model_inference/dense/main.c index e03fe748f6..3e6bd52850 100644 --- a/paddle/capi/examples/model_inference/dense/main.c +++ b/paddle/capi/examples/model_inference/dense/main.c @@ -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)); diff --git a/paddle/capi/examples/model_inference/multi_thread/main.c b/paddle/capi/examples/model_inference/multi_thread/main.c index ab0eb32c58..d7675cd80a 100644 --- a/paddle/capi/examples/model_inference/multi_thread/main.c +++ b/paddle/capi/examples/model_inference/multi_thread/main.c @@ -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)); diff --git a/paddle/capi/examples/model_inference/sequence/main.c b/paddle/capi/examples/model_inference/sequence/main.c index 142793cdb3..50bc0c9201 100644 --- a/paddle/capi/examples/model_inference/sequence/main.c +++ b/paddle/capi/examples/model_inference/sequence/main.c @@ -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; diff --git a/paddle/capi/examples/model_inference/sparse_binary/main.c b/paddle/capi/examples/model_inference/sparse_binary/main.c index 776ad87891..8ba67aee56 100644 --- a/paddle/capi/examples/model_inference/sparse_binary/main.c +++ b/paddle/capi/examples/model_inference/sparse_binary/main.c @@ -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)); diff --git a/paddle/capi/tests/test_Arguments.cpp b/paddle/capi/tests/test_Arguments.cpp index 012901a491..4792ceb49a 100644 --- a/paddle/capi/tests/test_Arguments.cpp +++ b/paddle/capi/tests/test_Arguments.cpp @@ -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, diff --git a/paddle/capi/tests/test_GradientMachine.cpp b/paddle/capi/tests/test_GradientMachine.cpp index 6c8d74c90b..89aa64608d 100644 --- a/paddle/capi/tests/test_GradientMachine.cpp +++ b/paddle/capi/tests/test_GradientMachine.cpp @@ -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 paddleInArgs; std::vector paddleOutArgs; paddleInArgs.resize(1); -- GitLab