diff --git a/paddle/api/PaddleAPI.h b/paddle/api/PaddleAPI.h index c8800519bd2fcd8d3f0f75d5f8f093985ec227ee..725328ce4d29b5e39910d7ad9c78fd2f07fc0a9e 100644 --- a/paddle/api/PaddleAPI.h +++ b/paddle/api/PaddleAPI.h @@ -19,9 +19,9 @@ limitations under the License. */ #include #include #include +#include "paddle/gserver/gradientmachines/GradientMachine.h" #include "paddle/utils/Common.h" #include "paddle/utils/GlobalConstants.h" -#include "paddle/gserver/gradientmachines/GradientMachine.h" /// Import PaddlePaddle's enumeration into global namespace. using namespace paddle::enumeration_wrapper; // NOLINT @@ -470,7 +470,8 @@ private: enum GradientMatchineCreateMode { CREATE_MODE_NORMAL = paddle::GradientMachine::kNormal, - CREATE_MODE_SGD_SPARSE_CPU_TRAINING = paddle::GradientMachine::kSgdSparseCpuTraining, + CREATE_MODE_SGD_SPARSE_CPU_TRAINING = + paddle::GradientMachine::kSgdSparseCpuTraining, CREATE_MODE_TESTING = paddle::GradientMachine::kTesting }; @@ -819,7 +820,8 @@ private: public: static ParameterUpdater* createLocalUpdater(OptimizationConfig* config); static ParameterUpdater* createRemoteUpdater(OptimizationConfig* config, - int passCount, bool userSparseUpdater); + int passCount, + bool userSparseUpdater); ~ParameterUpdater(); /** diff --git a/paddle/api/ParameterUpdater.cpp b/paddle/api/ParameterUpdater.cpp index e96ccc928549d0f2e433cc6914b721f5e073b545..708379ded5b74cc37fb1ad5ec98950ac247ce36e 100644 --- a/paddle/api/ParameterUpdater.cpp +++ b/paddle/api/ParameterUpdater.cpp @@ -32,12 +32,16 @@ ParameterUpdater *ParameterUpdater::createRemoteUpdater( OptimizationConfig *config, int passCount, bool userSparseUpdater) { auto updater = new ParameterUpdater(); auto remoteUpdater = new paddle::RemoteParameterUpdater( - config->m->getConfig(), passCount, nullptr); + config->m->getConfig(), passCount, nullptr); if (userSparseUpdater) { std::unique_ptr remoteUpdaterPtr; remoteUpdaterPtr.reset(remoteUpdater); - auto sparseRemoteUpdater = new paddle::SparseRemoteParameterUpdaterComposite( - config->m->getConfig(), passCount, false, std::move(remoteUpdaterPtr)); + auto sparseRemoteUpdater = + new paddle::SparseRemoteParameterUpdaterComposite( + config->m->getConfig(), + passCount, + false, + std::move(remoteUpdaterPtr)); updater->m->updater.reset(sparseRemoteUpdater); } else { updater->m->updater.reset(remoteUpdater); diff --git a/paddle/function/BufferArgTest.cpp b/paddle/function/BufferArgTest.cpp index 1744f377808f137dcda4a28acce336dc22be3d01..f1a234ab1a1068e1b98a86eaf9d79dbf4edf04b2 100644 --- a/paddle/function/BufferArgTest.cpp +++ b/paddle/function/BufferArgTest.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 "BufferArg.h" #include +#include "BufferArg.h" #include "paddle/math/MemoryHandle.h" namespace paddle { diff --git a/paddle/function/FunctionTest.cpp b/paddle/function/FunctionTest.cpp index fdf7e631e5ab8c67eb5cf906bd0af49740d60112..f9ea7c7e4f6ed31321cf7fe62371c2e9dd685a86 100644 --- a/paddle/function/FunctionTest.cpp +++ b/paddle/function/FunctionTest.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 "Function.h" #include +#include "Function.h" #include "paddle/math/SparseMatrix.h" namespace paddle { diff --git a/paddle/function/TensorShapeTest.cpp b/paddle/function/TensorShapeTest.cpp index 45a2e106e7fc3f0e9e57cf8c2bb549d747f4f49b..e19afe0c4d594c9ff40d0a3a86682f3ff241d82c 100644 --- a/paddle/function/TensorShapeTest.cpp +++ b/paddle/function/TensorShapeTest.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 "TensorShape.h" #include +#include "TensorShape.h" namespace paddle { diff --git a/paddle/function/TensorTypeTest.cpp b/paddle/function/TensorTypeTest.cpp index e50e46f3e99111731d9587f3e4ddfd4b26ae27e9..5b5c504ae2a330e19b8fddcef0dbf98014b80572 100644 --- a/paddle/function/TensorTypeTest.cpp +++ b/paddle/function/TensorTypeTest.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 "TensorType.h" #include +#include "TensorType.h" namespace paddle { diff --git a/python/paddle/v2/optimizer.py b/python/paddle/v2/optimizer.py index 6fefd7b2f241342da85e0d08ea88c378f98a674b..7bac1ea3b989a085d45e7988bcb3fc0329c1fba8 100644 --- a/python/paddle/v2/optimizer.py +++ b/python/paddle/v2/optimizer.py @@ -42,8 +42,8 @@ class Optimizer(object): return swig_api.ParameterUpdater.createLocalUpdater(self.__opt_conf__) def create_remote_updater(self, pass_num, use_sparse_updater): - return swig_api.ParameterUpdater.createRemoteUpdater(self.__opt_conf__, - pass_num, use_sparse_updater) + return swig_api.ParameterUpdater.createRemoteUpdater( + self.__opt_conf__, pass_num, use_sparse_updater) class Momentum(Optimizer): diff --git a/python/paddle/v2/trainer.py b/python/paddle/v2/trainer.py index dc23eb5b0d74ab69b662747fb6e1a77f8f7dae46..80f243b4137d3dce4fdc6026542c9dc8b8a8e765 100644 --- a/python/paddle/v2/trainer.py +++ b/python/paddle/v2/trainer.py @@ -42,7 +42,12 @@ class SGD(object): :type extra_layers: paddle.v2.config_base.Layer """ - def __init__(self, cost, parameters, update_equation, extra_layers=None, is_local=True): + def __init__(self, + cost, + parameters, + update_equation, + extra_layers=None, + is_local=True): if not isinstance(parameters, v2_parameters.Parameters): raise TypeError('parameters should be parameters') @@ -97,8 +102,8 @@ class SGD(object): if self.__is_local__: updater = self.__optimizer__.create_local_updater() else: - updater = self.__optimizer__.create_remote_updater(num_passes, - self.__use_sparse_updater__) + updater = self.__optimizer__.create_remote_updater( + num_passes, self.__use_sparse_updater__) updater.init(self.__gradient_machine__) self.__gradient_machine__.start()