optimizer.c 535 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#include <stdlib.h>

#include "optimizer.h"

typedef struct {
  double learning_rate;
} SGD_optimizer;

paddle_optimizer* paddle_create_SGD_optimizer(double learning_rate) {
  SGD_optimizer* o = (SGD_optimizer*)malloc(sizeof(SGD_optimizer));
  o->learning_rate = learning_rate;
  return (paddle_optimizer*)o;
}

void paddle_release_optimizer(paddle_optimizer* o) {
  free(o);
}

int paddle_update_parameter(paddle_optimizer* o, void *buffer, paddle_element_type datatype, const void* gradient, int num_bytes) {
  // TODO
  return 0;
}