Funktion implementiert / nicht getestet
This commit is contained in:
parent
2436240736
commit
84b65525a6
@ -6,9 +6,30 @@
|
|||||||
#include "neuralNetwork.h"
|
#include "neuralNetwork.h"
|
||||||
|
|
||||||
|
|
||||||
|
static void erzeugeMatrix(FILE *file, const Matrix *m)
|
||||||
|
{
|
||||||
|
fwrite(&m->rows, sizeof(int), 1, file);
|
||||||
|
fwrite(&m->cols, sizeof(int), 1, file);
|
||||||
|
fwrite(m->buffer, sizeof(MatrixType), m->rows * m->cols, file);
|
||||||
|
}
|
||||||
|
|
||||||
static void prepareNeuralNetworkFile(const char *path, const NeuralNetwork nn)
|
static void prepareNeuralNetworkFile(const char *path, const NeuralNetwork nn)
|
||||||
{
|
{
|
||||||
// TODO
|
FILE *file = fopen(path, "wb");
|
||||||
|
if (!file)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const char *header = "__info2_neural_network_file_format__";
|
||||||
|
fwrite(header, sizeof(char), strlen(header), file);
|
||||||
|
fwrite(&nn.numberOfLayers, sizeof(int), 1, file);
|
||||||
|
|
||||||
|
for (int i = 0; i < nn.numberOfLayers; i++)
|
||||||
|
{
|
||||||
|
erzeugeMatrix(file, &nn.layers[i].weights);
|
||||||
|
erzeugeMatrix(file, &nn.layers[i].biases);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_loadModelReturnsCorrectNumberOfLayers(void)
|
void test_loadModelReturnsCorrectNumberOfLayers(void)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user