From 4e238675c8c3bee558df95febd510496c016e2e0 Mon Sep 17 00:00:00 2001 From: Jonas Date: Sat, 15 Nov 2025 19:24:08 +0100 Subject: [PATCH] small improvements --- .../Start_Mac/neuralNetworkTests.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/I2_NeuronalerAbsturz/Start_Mac/neuralNetworkTests.c b/I2_NeuronalerAbsturz/Start_Mac/neuralNetworkTests.c index 1096e2b..c11aa00 100644 --- a/I2_NeuronalerAbsturz/Start_Mac/neuralNetworkTests.c +++ b/I2_NeuronalerAbsturz/Start_Mac/neuralNetworkTests.c @@ -55,27 +55,18 @@ static void prepareNeuralNetworkFile(const char *path, const NeuralNetwork nn) // input und output dimension schreiben int inputDim = nn.layers[0].weights.cols; - int outputDim = nn.layers[0].weights.rows; fwrite(&inputDim, sizeof(int), 1, file); - fwrite(&outputDim, sizeof(int), 1, file); - - // erstes Layer schreiben - int weightCount = nn.layers[0].weights.rows * nn.layers[0].weights.cols; - fwrite(nn.layers[0].weights.buffer, sizeof(MatrixType), weightCount, file); - - int biasesCount = nn.layers[0].biases.rows * nn.layers[0].biases.cols; - fwrite(nn.layers[0].biases.buffer, sizeof(MatrixType), biasesCount, file); // für weiter Layer nur outputDimension schreiben - for (unsigned int i = 1; i < nn.numberOfLayers; i++) + for (unsigned int i = 0; i < nn.numberOfLayers; i++) { - outputDim = nn.layers[i].weights.rows; + int outputDim = nn.layers[i].weights.rows; fwrite(&outputDim, sizeof(int), 1, file); - weightCount = nn.layers[i].weights.rows * nn.layers[i].weights.cols; + int weightCount = nn.layers[i].weights.rows * nn.layers[i].weights.cols; fwrite(nn.layers[i].weights.buffer, sizeof(MatrixType), weightCount, file); - biasesCount = nn.layers[i].biases.rows * nn.layers[i].biases.cols; + int biasesCount = nn.layers[i].biases.rows * nn.layers[i].biases.cols; fwrite(nn.layers[i].biases.buffer, sizeof(MatrixType), biasesCount, file); }