generated from freudenreichan/info2Praktikum-NeuronalesNetz
Tried adding a function writing a test file for neuralNetworkTests
This commit is contained in:
parent
0a8349d722
commit
cfb3848fe2
@ -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)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user