From 599eb3663e3124f976dfa3d487e47534df61a899 Mon Sep 17 00:00:00 2001 From: Helin Wang Date: Sun, 21 May 2017 19:29:34 -0400 Subject: [PATCH] do clang-format --- paddle/go/pserver/optimizer.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/paddle/go/pserver/optimizer.c b/paddle/go/pserver/optimizer.c index 8d63089b4cd..b8da3ec9592 100644 --- a/paddle/go/pserver/optimizer.c +++ b/paddle/go/pserver/optimizer.c @@ -2,10 +2,10 @@ #include "optimizer.h" -typedef int (*update_func)(void*, void *, paddle_element_type, const void*, int); +typedef int (*update_func)(void*, void*, paddle_element_type, const void*, int); typedef void (*release_func)(void*); -typedef struct paddle_optimizer{ +typedef struct paddle_optimizer { update_func update; release_func release; void* optimizer; @@ -16,23 +16,29 @@ void paddle_release_optimizer(paddle_optimizer* o) { free(o); } -int paddle_update_parameter(paddle_optimizer* o, void *buffer, paddle_element_type element_type, const void* gradient, int num_bytes) { +int paddle_update_parameter(paddle_optimizer* o, + void* buffer, + paddle_element_type element_type, + const void* gradient, + int num_bytes) { return o->update(o->optimizer, buffer, element_type, gradient, num_bytes); } -typedef struct { - double learning_rate; -} SGD_optimizer; +typedef struct { double learning_rate; } SGD_optimizer; -int update_SGD(void* optimizer, void *buffer, paddle_element_type element_type, const void* gradient, int num_bytes) { +int update_SGD(void* optimizer, + void* buffer, + paddle_element_type element_type, + const void* gradient, + int num_bytes) { SGD_optimizer* o = (SGD_optimizer*)optimizer; // TODO return 0; } -void release_SGD(void *optimizer) { - SGD_optimizer* o = (SGD_optimizer*)optimizer; - // nothing allocated on heap +void release_SGD(void* optimizer) { + SGD_optimizer* o = (SGD_optimizer*)optimizer; + // nothing allocated on heap } paddle_optimizer* paddle_create_SGD_optimizer(double learning_rate) { -- GitLab