Tried adding a function writing a test file for neuralNetworkTests

This commit is contained in:
Lukas Weber 2025-11-26 11:48:37 +01:00
parent 0a8349d722
commit cfb3848fe2

View File

@ -9,6 +9,12 @@
static void prepareNeuralNetworkFile(const char *path, const NeuralNetwork nn) static void prepareNeuralNetworkFile(const char *path, const NeuralNetwork nn)
{ {
// TODO // TODO
FILE file = fopen(path, "wb");
fwrite(path, sizeof(const char), 24, file);
for(int i = 0; i < nn.numberOfLayers; i++) {
fwrite(nn.layers[i].weights.buffer, sizeof(MatrixType), nn.layers[i].weights.rows * nn.layers[i].weights.cols, file);
fwrite(nn.layers[i].biases.buffer, sizeof(MatrixType), nn.layers[i].biases.rows * nn.layers[i].biases.cols, file);
fwrite(nn.layers[i].activation->buffer, sizeof(MatrixType), nn.layers[i].activation->rows * nn.layers[i].activation->cols, file);
} }
void test_loadModelReturnsCorrectNumberOfLayers(void) void test_loadModelReturnsCorrectNumberOfLayers(void)