From e9b26e6cae80a089f6b969226a968f5b79a7820b Mon Sep 17 00:00:00 2001 From: jvech Date: Thu, 27 Jul 2023 23:22:30 -0500 Subject: fix: weights allocation mistake fixed --- src/nn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nn.c b/src/nn.c index 63084a1..d773324 100644 --- a/src/nn.c +++ b/src/nn.c @@ -39,8 +39,8 @@ void nn_network_init_weights(Layer layers[], size_t nmemb, size_t n_inputs) for (i = 0; i < nmemb; i++) { - layers[i].weights = calloc(prev_size * layers[i].neurons, sizeof(Layer)); - layers[i].bias = calloc(layers[i].neurons, sizeof(Layer)); + layers[i].weights = calloc(prev_size * layers[i].neurons, sizeof(double)); + layers[i].bias = calloc(layers[i].neurons, sizeof(double)); if (layers[i].weights == NULL || layers[i].bias == NULL) { goto nn_layers_calloc_weights_error; -- cgit v1.2.3-70-g09d2