prepareNeuralNetworkFile angepasst, sodass Test PASS läuft
This commit is contained in:
parent
28a968e2c9
commit
53a7828cf0
@ -22,12 +22,19 @@ static void prepareNeuralNetworkFile(const char *path, const NeuralNetwork nn)
|
|||||||
for (unsigned int i = 0; i < nn.numberOfLayers; i++) {
|
for (unsigned int i = 0; i < nn.numberOfLayers; i++) {
|
||||||
Layer layer = nn.layers[i];
|
Layer layer = nn.layers[i];
|
||||||
|
|
||||||
unsigned int inputDim = layer.weights.cols; // Anzahl Eingänge
|
|
||||||
unsigned int outputDim = layer.weights.rows; // Anzahl Ausgänge
|
|
||||||
|
|
||||||
// Dimensionen schreiben
|
if(i == 0){
|
||||||
|
// beim ersten Layer inputDim und outputDim schreiben
|
||||||
|
unsigned int inputDim = layer.weights.cols; // Anzahl Eingänge
|
||||||
fwrite(&inputDim, sizeof(unsigned int), 1, file);
|
fwrite(&inputDim, sizeof(unsigned int), 1, file);
|
||||||
|
unsigned int outputDim = layer.weights.rows; // Anzahl Ausgänge
|
||||||
fwrite(&outputDim, sizeof(unsigned int), 1, file);
|
fwrite(&outputDim, sizeof(unsigned int), 1, file);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
// bei allen anderen Layern nur outputDim schreiben
|
||||||
|
unsigned int outputDim = layer.weights.rows; // Anzahl Ausgänge
|
||||||
|
fwrite(&outputDim, sizeof(unsigned int), 1, file);
|
||||||
|
}
|
||||||
|
|
||||||
// Gewichte schreiben
|
// Gewichte schreiben
|
||||||
size_t weightCount = layer.weights.rows * layer.weights.cols;
|
size_t weightCount = layer.weights.rows * layer.weights.cols;
|
||||||
@ -38,8 +45,7 @@ static void prepareNeuralNetworkFile(const char *path, const NeuralNetwork nn)
|
|||||||
fwrite(layer.biases.buffer, sizeof(MatrixType), biasCount, file);
|
fwrite(layer.biases.buffer, sizeof(MatrixType), biasCount, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// End-Marker (outputDim = 0)
|
||||||
// End-Marker (inputDim = 0)
|
|
||||||
unsigned int zero = 0;
|
unsigned int zero = 0;
|
||||||
fwrite(&zero, sizeof(unsigned int), 1, file);
|
fwrite(&zero, sizeof(unsigned int), 1, file);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user