aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjvech <jmvalenciae@unal.edu.co>2023-07-27 23:22:30 -0500
committerjvech <jmvalenciae@unal.edu.co>2023-07-27 23:22:30 -0500
commite9b26e6cae80a089f6b969226a968f5b79a7820b (patch)
tree31c217a95092e2c2a89d9b4e581a0b4fdfe635a2 /src
parentd8905e0ef4c05f5cea9c6c00cede7492c770e152 (diff)
fix: weights allocation mistake fixed
Diffstat (limited to 'src')
-rw-r--r--src/nn.c4
1 files changed, 2 insertions, 2 deletions
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;
Feel free to download, copy and edit any repo