Some conv-lstm, sgdr and other fixes

This commit is contained in:
AlexeyAB
2019-05-14 14:35:22 +03:00
parent 4f72fcc015
commit 038289eb7d
10 changed files with 114 additions and 51 deletions

View File

@ -1046,13 +1046,9 @@ void backward_convolutional_layer(convolutional_layer l, network_state state)
}
}
void update_convolutional_layer(convolutional_layer l, update_args a)
void update_convolutional_layer(convolutional_layer l, int batch, float learning_rate, float momentum, float decay)
{
float learning_rate = a.learning_rate*l.learning_rate_scale;
float momentum = a.momentum;
float decay = a.decay;
int batch = a.batch;
//int size = l.size*l.size*l.c*l.n;
axpy_cpu(l.n, learning_rate / batch, l.bias_updates, 1, l.biases, 1);
scal_cpu(l.n, momentum, l.bias_updates, 1);
@ -1067,6 +1063,7 @@ void update_convolutional_layer(convolutional_layer l, update_args a)
}
image get_convolutional_weight(convolutional_layer l, int i)
{
int h = l.size;
@ -1101,7 +1098,7 @@ void rescale_weights(convolutional_layer l, float scale, float trans)
image *get_weights(convolutional_layer l)
{
image *weights = calloc(l.n, sizeof(image));
image *weights = (image *)calloc(l.n, sizeof(image));
int i;
for (i = 0; i < l.n; ++i) {
weights[i] = copy_image(get_convolutional_weight(l, i));