From d49c6274ca2f7dafeaa116bc422f7d0c0c67f96b Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Fri, 24 Mar 2017 16:07:05 +0800 Subject: [PATCH] GNU Style API --- paddle/capi/Arguments.cpp | 2 +- paddle/capi/CMakeLists.txt | 4 ++-- paddle/capi/Main.cpp | 4 ++-- paddle/capi/Matrix.cpp | 4 ++-- paddle/capi/Vector.cpp | 4 ++-- paddle/capi/{PaddleCAPI.h => capi.h} | 4 ++-- paddle/capi/{PaddleCAPIPrivate.h => capi_private.h} | 2 +- paddle/capi/gradient_machine.cpp | 4 ++-- paddle/capi/tests/test_Arguments.cpp | 2 +- paddle/capi/tests/test_GradientMachine.cpp | 2 +- paddle/capi/tests/test_Matrix.cpp | 2 +- paddle/capi/tests/test_Vector.cpp | 2 +- 12 files changed, 18 insertions(+), 18 deletions(-) rename paddle/capi/{PaddleCAPI.h => capi.h} (94%) rename paddle/capi/{PaddleCAPIPrivate.h => capi_private.h} (98%) diff --git a/paddle/capi/Arguments.cpp b/paddle/capi/Arguments.cpp index d9b207af7..2954f522c 100644 --- a/paddle/capi/Arguments.cpp +++ b/paddle/capi/Arguments.cpp @@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "PaddleCAPIPrivate.h" #include "arguments.h" +#include "capi_private.h" using paddle::capi::cast; diff --git a/paddle/capi/CMakeLists.txt b/paddle/capi/CMakeLists.txt index a2b1929e4..1b52a79ce 100644 --- a/paddle/capi/CMakeLists.txt +++ b/paddle/capi/CMakeLists.txt @@ -13,7 +13,7 @@ configure_file(config.h.in config.h @ONLY) # PaddleCAPI.h is the only header we exposed. It currently only used for model # inference. file(GLOB CAPI_HEADERS *.h) -set(CAPI_PRIVATE_HEADER PaddleCAPIPrivate.h) +set(CAPI_PRIVATE_HEADER capi_private.h) list(REMOVE_ITEM CAPI_HEADERS ${CAPI_PRIVATE_HEADER}) file(GLOB CAPI_SOURCES *.cpp) @@ -59,7 +59,7 @@ link_paddle_exe(paddle_capi_shared) # install library & headers. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${capi_whole_library} DESTINATION lib) -install(FILES ${CAPI_HEADER} DESTINATION include/paddle) +install(FILES ${CAPI_HEADERS} DESTINATION include/paddle) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h DESTINATION include/paddle) install(TARGETS paddle_capi_shared DESTINATION lib) diff --git a/paddle/capi/Main.cpp b/paddle/capi/Main.cpp index 7604945de..7f24561e9 100644 --- a/paddle/capi/Main.cpp +++ b/paddle/capi/Main.cpp @@ -16,8 +16,8 @@ limitations under the License. */ #include #include #include -#include "PaddleCAPI.h" -#include "PaddleCAPIPrivate.h" +#include "capi_private.h" +#include "main.h" #include "paddle/trainer/TrainerConfigHelper.h" #include "paddle/utils/Excepts.h" #include "paddle/utils/PythonUtil.h" diff --git a/paddle/capi/Matrix.cpp b/paddle/capi/Matrix.cpp index fe60832d7..85269e188 100644 --- a/paddle/capi/Matrix.cpp +++ b/paddle/capi/Matrix.cpp @@ -12,9 +12,9 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "PaddleCAPI.h" -#include "PaddleCAPIPrivate.h" +#include "capi_private.h" #include "hl_cuda.h" +#include "matrix.h" #define cast(v) paddle::capi::cast(v) extern "C" { diff --git a/paddle/capi/Vector.cpp b/paddle/capi/Vector.cpp index 4ccb167fe..564708e96 100644 --- a/paddle/capi/Vector.cpp +++ b/paddle/capi/Vector.cpp @@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "PaddleCAPI.h" -#include "PaddleCAPIPrivate.h" +#include "capi_private.h" +#include "vector.h" using paddle::capi::cast; diff --git a/paddle/capi/PaddleCAPI.h b/paddle/capi/capi.h similarity index 94% rename from paddle/capi/PaddleCAPI.h rename to paddle/capi/capi.h index 1e275c5c1..4097a1a35 100644 --- a/paddle/capi/PaddleCAPI.h +++ b/paddle/capi/capi.h @@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#ifndef PADDLECAPI_H_ -#define PADDLECAPI_H_ +#ifndef __PADDLE_CAPI_H__ +#define __PADDLE_CAPI_H__ /** * Paddle C API. It will replace SWIG as Multiple Language API for model diff --git a/paddle/capi/PaddleCAPIPrivate.h b/paddle/capi/capi_private.h similarity index 98% rename from paddle/capi/PaddleCAPIPrivate.h rename to paddle/capi/capi_private.h index 072e9a37a..c7cdbd5f6 100644 --- a/paddle/capi/PaddleCAPIPrivate.h +++ b/paddle/capi/capi_private.h @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "PaddleCAPI.h" +#include "capi.h" #include "paddle/gserver/gradientmachines/GradientMachine.h" #include "paddle/math/Matrix.h" #include "paddle/math/Vector.h" diff --git a/paddle/capi/gradient_machine.cpp b/paddle/capi/gradient_machine.cpp index ab8e747ae..6e7740a45 100644 --- a/paddle/capi/gradient_machine.cpp +++ b/paddle/capi/gradient_machine.cpp @@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "PaddleCAPI.h" -#include "PaddleCAPIPrivate.h" +#include "gradient_machine.h" +#include "capi_private.h" #include "paddle/gserver/gradientmachines/NeuralNetwork.h" #define cast(v) paddle::capi::cast(v) diff --git a/paddle/capi/tests/test_Arguments.cpp b/paddle/capi/tests/test_Arguments.cpp index 60fa57517..e6e4ac993 100644 --- a/paddle/capi/tests/test_Arguments.cpp +++ b/paddle/capi/tests/test_Arguments.cpp @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ #include -#include "PaddleCAPI.h" +#include "capi.h" #include "gtest/gtest.h" #include "paddle/utils/ThreadLocal.h" diff --git a/paddle/capi/tests/test_GradientMachine.cpp b/paddle/capi/tests/test_GradientMachine.cpp index 3e8ba8e9d..b37fe83a3 100644 --- a/paddle/capi/tests/test_GradientMachine.cpp +++ b/paddle/capi/tests/test_GradientMachine.cpp @@ -18,7 +18,7 @@ limitations under the License. */ #include #include #include -#include "PaddleCAPI.h" +#include "capi.h" #include "paddle/utils/ThreadLocal.h" static std::vector randomBuffer(size_t bufSize) { diff --git a/paddle/capi/tests/test_Matrix.cpp b/paddle/capi/tests/test_Matrix.cpp index 1b3b881ca..162df448d 100644 --- a/paddle/capi/tests/test_Matrix.cpp +++ b/paddle/capi/tests/test_Matrix.cpp @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "PaddleCAPI.h" +#include "capi.h" #include "gtest/gtest.h" TEST(CAPIMatrix, create) { diff --git a/paddle/capi/tests/test_Vector.cpp b/paddle/capi/tests/test_Vector.cpp index 64c19265e..c5c57b728 100644 --- a/paddle/capi/tests/test_Vector.cpp +++ b/paddle/capi/tests/test_Vector.cpp @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "PaddleCAPI.h" +#include "capi.h" #include "gtest/gtest.h" TEST(CAPIVector, create) { -- GitLab