| | |
| | | |
| | | connected_layer *make_connected_layer(int inputs, int outputs, ACTIVATION activation) |
| | | { |
| | | printf("Connected Layer: %d inputs, %d outputs\n", inputs, outputs); |
| | | fprintf(stderr, "Connected Layer: %d inputs, %d outputs\n", inputs, outputs); |
| | | int i; |
| | | connected_layer *layer = calloc(1, sizeof(connected_layer)); |
| | | layer->inputs = inputs; |
| | |
| | | layer->biases = calloc(outputs, sizeof(double)); |
| | | for(i = 0; i < outputs; ++i) |
| | | //layer->biases[i] = rand_normal()*scale + scale; |
| | | layer->biases[i] = 1; |
| | | layer->biases[i] = 0; |
| | | |
| | | layer->activation = activation; |
| | | return layer; |
| | |
| | | int index = i*layer.inputs+j; |
| | | layer.weight_momentum[index] = step*(layer.weight_updates[index] - decay*layer.weights[index]) + momentum*layer.weight_momentum[index]; |
| | | layer.weights[index] += layer.weight_momentum[index]; |
| | | //layer.weights[index] = constrain(layer.weights[index], 100.); |
| | | } |
| | | } |
| | | memset(layer.bias_updates, 0, layer.outputs*sizeof(double)); |