From 873368f8422ea5815e6f0c02df84ec1960438b4a Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Tue, 10 Jan 2017 16:53:32 +0800 Subject: [PATCH] Add style check to target --- paddle/capi/Arguments.cpp | 14 ++++++++++++++ paddle/capi/CMakeLists.txt | 2 ++ paddle/capi/GradientMachine.cpp | 17 +++++++++++++++-- paddle/capi/Main.cpp | 14 ++++++++++++++ paddle/capi/Matrix.cpp | 14 ++++++++++++++ paddle/capi/PaddleCAPI.h | 21 ++++++++++++++++++--- paddle/capi/PaddleCAPIPrivate.h | 18 ++++++++++++++++-- paddle/capi/Vector.cpp | 14 ++++++++++++++ paddle/capi/tests/test_Arguments.cpp | 14 ++++++++++++++ paddle/capi/tests/test_GradientMachine.cpp | 14 ++++++++++++++ paddle/capi/tests/test_Matrix.cpp | 18 ++++++++++++++++-- paddle/capi/tests/test_Vector.cpp | 14 ++++++++++++++ 12 files changed, 165 insertions(+), 9 deletions(-) diff --git a/paddle/capi/Arguments.cpp b/paddle/capi/Arguments.cpp index b983d72bb4..60bdea15ae 100644 --- a/paddle/capi/Arguments.cpp +++ b/paddle/capi/Arguments.cpp @@ -1,3 +1,17 @@ +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +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" diff --git a/paddle/capi/CMakeLists.txt b/paddle/capi/CMakeLists.txt index 93b6b41254..6eb1e9949a 100644 --- a/paddle/capi/CMakeLists.txt +++ b/paddle/capi/CMakeLists.txt @@ -15,6 +15,8 @@ file(GLOB CAPI_SOURCES *.cpp) add_library(paddle_capi STATIC ${CAPI_SOURCES}) target_include_directories(paddle_capi PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) +add_style_check_target(paddle_capi ${CAPI_SOURCES} ${CAPI_HEADER} + ${CAPI_PRIVATE_HEADER}) add_dependencies(paddle_capi gen_proto_cpp) set(PADDLE_CAPI_INC_PATH diff --git a/paddle/capi/GradientMachine.cpp b/paddle/capi/GradientMachine.cpp index ef584ed8d0..8299e6442f 100644 --- a/paddle/capi/GradientMachine.cpp +++ b/paddle/capi/GradientMachine.cpp @@ -1,3 +1,17 @@ +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +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 "paddle/gserver/gradientmachines/NeuralNetwork.h" @@ -21,7 +35,7 @@ NeuralNetwork* newCustomNerualNetwork(const std::string& name, NeuralNetwork* network) { return new MyNeuralNetwork(name, network); } -} +} // namespace paddle extern "C" { int PDGradientMachineCreateForPredict(PD_GradiemtMachine* machine, @@ -91,7 +105,6 @@ int PDGradientMachineCreateSharedParam(PD_GradiemtMachine origin, auto p = o->machine->getParameters()[paramId]; param->enableSharedType(paddle::PARAMETER_VALUE, p->getBuf(paddle::PARAMETER_VALUE)); - }, {paddle::PARAMETER_VALUE}, false); diff --git a/paddle/capi/Main.cpp b/paddle/capi/Main.cpp index 8cd0104be2..e310eb5404 100644 --- a/paddle/capi/Main.cpp +++ b/paddle/capi/Main.cpp @@ -1,3 +1,17 @@ +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +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 #include #include diff --git a/paddle/capi/Matrix.cpp b/paddle/capi/Matrix.cpp index dc1b4f3379..db32c94541 100644 --- a/paddle/capi/Matrix.cpp +++ b/paddle/capi/Matrix.cpp @@ -1,3 +1,17 @@ +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +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 "hl_cuda.h" diff --git a/paddle/capi/PaddleCAPI.h b/paddle/capi/PaddleCAPI.h index b848603e8a..8cd78429f3 100644 --- a/paddle/capi/PaddleCAPI.h +++ b/paddle/capi/PaddleCAPI.h @@ -1,5 +1,19 @@ -#ifndef __PADDLE_PADDLE_CAPI_PADDLECAPI_H_INCLUDED__ -#define __PADDLE_PADDLE_CAPI_PADDLECAPI_H_INCLUDED__ +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +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_ #include #include #include "config.h" @@ -79,4 +93,5 @@ int PDInit(int argc, char** argv); #ifdef __cplusplus } #endif -#endif + +#endif // PADDLECAPI_H_ diff --git a/paddle/capi/PaddleCAPIPrivate.h b/paddle/capi/PaddleCAPIPrivate.h index 1aae3cedf3..bb8baea4e1 100644 --- a/paddle/capi/PaddleCAPIPrivate.h +++ b/paddle/capi/PaddleCAPIPrivate.h @@ -1,3 +1,17 @@ +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +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 "paddle/gserver/gradientmachines/GradientMachine.h" #include "paddle/math/Matrix.h" @@ -48,5 +62,5 @@ template inline T* cast(void* ptr) { return reinterpret_cast(ptr); } -} -} +} // namespace capi +} // namespace paddle diff --git a/paddle/capi/Vector.cpp b/paddle/capi/Vector.cpp index 2ac795668f..5b4fe0666c 100644 --- a/paddle/capi/Vector.cpp +++ b/paddle/capi/Vector.cpp @@ -1,3 +1,17 @@ +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +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" diff --git a/paddle/capi/tests/test_Arguments.cpp b/paddle/capi/tests/test_Arguments.cpp index fe9762deed..4a18ffbf47 100644 --- a/paddle/capi/tests/test_Arguments.cpp +++ b/paddle/capi/tests/test_Arguments.cpp @@ -1,3 +1,17 @@ +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +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 "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 63fb47bd27..fcade7fb5c 100644 --- a/paddle/capi/tests/test_GradientMachine.cpp +++ b/paddle/capi/tests/test_GradientMachine.cpp @@ -1,3 +1,17 @@ +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +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 #include #include diff --git a/paddle/capi/tests/test_Matrix.cpp b/paddle/capi/tests/test_Matrix.cpp index 97913f7229..4192dd6bfb 100644 --- a/paddle/capi/tests/test_Matrix.cpp +++ b/paddle/capi/tests/test_Matrix.cpp @@ -1,3 +1,17 @@ +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +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 "gtest/gtest.h" @@ -21,8 +35,8 @@ TEST(CAPIMatrix, create) { uint64_t height, width; ASSERT_EQ(kPD_NO_ERROR, PDMatGetShape(mat, &height, &width)); - ASSERT_EQ(128, height); - ASSERT_EQ(32, width); + ASSERT_EQ(128UL, height); + ASSERT_EQ(32UL, width); ASSERT_EQ(kPD_NO_ERROR, PDMatDestroy(mat)); } diff --git a/paddle/capi/tests/test_Vector.cpp b/paddle/capi/tests/test_Vector.cpp index 907a63bc9e..122f7df176 100644 --- a/paddle/capi/tests/test_Vector.cpp +++ b/paddle/capi/tests/test_Vector.cpp @@ -1,3 +1,17 @@ +/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +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 "gtest/gtest.h"