fix prep function

This commit is contained in:
reeceal105988 committed 2026-10-29 15:39:18 +01:00
1 parent 833a4c3c79
commit 70a7e6d20d
1 file changed
+5 -5
+5 -5
View File
@@ -13,17 +13,17 @@ static void prepareNeuralNetworkFile(const char *path, const NeuralNetwork nn)
if (fd == NULL) if (fd == NULL)
return; 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, sizeof(nn), 1, fd);
fwrite(&(nn.layers[0].weights.cols), sizeof(nn.layers[0].weights.cols), 1, fd); fwrite(&(nn.layers[0].weights.cols), sizeof(nn.layers[0].weights.cols), 1, fd);
for (int i = 0; i < nn.numberOfLayers; ++i) 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.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].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, 1, fd); fwrite(nn.layers[i].biases.buffer, sizeof(MatrixType), nn.layers[i].biases.rows, fd);
} }
const float zeroooooo = 0.0F; const int zeroooooo = 0;
fwrite(&zeroooooo, sizeof(MatrixType), 1, fd); fwrite(&zeroooooo, sizeof(int), 1, fd);
fclose(fd); fclose(fd);
} }