Continued testing for functionality

This commit is contained in:
Lukas Weber 2025-11-26 12:33:48 +01:00
parent bb96c8f78a
commit 0f28ee3f02

View File

@ -10,8 +10,15 @@ static void prepareNeuralNetworkFile(const char *path, const NeuralNetwork nn)
{
// TODO
FILE* file = fopen(path, "wb");
fwrite(path, sizeof(const char), 24, file);
fwrite(&(nn.nmberOfLayers), sizeof(unsigned int), 1, file);
if(file == NULL) {
printf("Failed to open file");
return;
}
const char* header = "__info2_neural_network_file_format__";
fwrite(header, sizeof(const char), strlen(header), file);
fwrite(&(nn.numberOfLayers), sizeof(unsigned int), 1, file);
fwrite(&(nn.numberOfLayers), sizeof(unsigned int), 1, file);
for(int i = 0; i < nn.numberOfLayers; i++) {
//write everything to do with weights
fwrite(&(nn.layers[i].weights.rows), sizeof(unsigned int), 1, file);
@ -23,6 +30,7 @@ static void prepareNeuralNetworkFile(const char *path, const NeuralNetwork nn)
fwrite(&(nn.layers[i].biases.cols), sizeof(unsigned int), 1, file);
fwrite(nn.layers[i].biases.buffer, sizeof(MatrixType), nn.layers[i].biases.rows * nn.layers[i].biases.cols, file);
}
fclose(file);
}
void test_loadModelReturnsCorrectNumberOfLayers(void)