From 70a7e6d20d1036c5658bed9db6e02772ac69d8d7 Mon Sep 17 00:00:00 2001 From: Alex Reece Date: Thu, 29 Oct 2026 15:39:18 +0100 Subject: [PATCH] fix prep function --- Startcode/neuralNetworkTests.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Startcode/neuralNetworkTests.c b/Startcode/neuralNetworkTests.c index dab12ab..c1eef28 100644 --- a/Startcode/neuralNetworkTests.c +++ b/Startcode/neuralNetworkTests.c @@ -13,17 +13,17 @@ static void prepareNeuralNetworkFile(const char *path, const NeuralNetwork nn) if (fd == NULL) return; - fwrite(FILE_HEADER_STRING, sizeof(FILE_HEADER_STRING) - 1, 1, fd); + fwrite(FILE_HEADER_STRING, strlen(FILE_HEADER_STRING), 1, fd); // fwrite(&nn, sizeof(nn), 1, fd); fwrite(&(nn.layers[0].weights.cols), sizeof(nn.layers[0].weights.cols), 1, fd); for (int i = 0; i < nn.numberOfLayers; ++i) { fwrite(&(nn.layers[i].weights.rows), sizeof(nn.layers[i].weights.rows), 1, fd); - fwrite(&(nn.layers[i].weights.buffer), sizeof(MatrixType) * nn.layers[i].weights.rows * nn.layers[i].weights.cols, 1, fd); - fwrite(&(nn.layers[i].biases.buffer), sizeof(MatrixType) * nn.layers[i].biases.rows, 1, fd); + fwrite(nn.layers[i].weights.buffer, sizeof(MatrixType), nn.layers[i].weights.rows * nn.layers[i].weights.cols, fd); + fwrite(nn.layers[i].biases.buffer, sizeof(MatrixType), nn.layers[i].biases.rows, fd); } - const float zeroooooo = 0.0F; - fwrite(&zeroooooo, sizeof(MatrixType), 1, fd); + const int zeroooooo = 0; + fwrite(&zeroooooo, sizeof(int), 1, fd); fclose(fd); }