grenade/cbits/gradient_decent.c
Huw Campbell ac0e4b22c8 Remove primes on shape instantiations
Add singletons for Shape and remove hacks on recurrent nets

Add Recurrent Nets
2017-01-14 21:09:07 +11:00

14 lines
439 B
C

#include "gradient_decent.h"
void decend_cpu(int len, double rate, double momentum, double regulariser,
const double* weights,
const double* gradient,
const double* last,
double* outputWeights, double* outputMomentum) {
for (int i = 0; i <= len; i++) {
outputMomentum[i] = momentum * last[i] - rate * gradient[i];
outputWeights[i] = weights[i] + outputMomentum[i] - (rate * regulariser) * weights[i];
}
}