Kommentare
This commit is contained in:
parent
c84c6d3929
commit
0406b66173
@ -128,8 +128,8 @@ NeuralNetwork loadModel(const char *path)
|
||||
{
|
||||
if(checkFileHeader(file))
|
||||
{
|
||||
unsigned int inputDimension = readDimension(file);
|
||||
unsigned int outputDimension = readDimension(file);
|
||||
unsigned int inputDimension = readDimension(file); // übergabe in neuralnetworktests
|
||||
unsigned int outputDimension = readDimension(file); // übergabe in neuralnetworktests
|
||||
|
||||
while(inputDimension > 0 && outputDimension > 0)
|
||||
{
|
||||
|
||||
@ -19,8 +19,8 @@ static void prepareNeuralNetworkFile(const char *path, const NeuralNetwork nn)
|
||||
for (unsigned int i = 0; i < nn.numberOfLayers; ++i)
|
||||
{
|
||||
const Layer *lay = &nn.layers[i];
|
||||
int inputDim = (int)lay->weights.cols;
|
||||
int outputDim = (int)lay->weights.rows;
|
||||
int inputDim = (int)lay->weights.cols; // Die Anzahl der Spalten der Gewichtsmatrix ist immer gleich der Input-Dimension
|
||||
int outputDim = (int)lay->weights.rows; // Anzahl der Reihen der Gewichtsmatrix ist immer gleich der Output-Dimension
|
||||
|
||||
// --- Spezifische Dimensions-Schreiblogik (Spiegelung der Leselogik) ---
|
||||
if (i == 0) {
|
||||
@ -37,9 +37,9 @@ static void prepareNeuralNetworkFile(const char *path, const NeuralNetwork nn)
|
||||
|
||||
// --- Matrizen-Daten schreiben ---
|
||||
// Schreibe Gewichtsmatrix (Daten):
|
||||
size_t weightCount = (size_t)lay->weights.rows * (size_t)lay->weights.cols; //size_t unsignierter ganzzahltyp
|
||||
if (weightCount > 0 && lay->weights.buffer != NULL) {
|
||||
// Schreibe alle MatrixType-Elemente (z.B. floats) der Gewichte.
|
||||
size_t weightCount = (size_t)lay->weights.rows * (size_t)lay->weights.cols; // Gesamtanzahl der Elemente in der Gewichtsmatrix berechnet (rows x cols) //size_t unsignierter ganzzahltyp
|
||||
if (weightCount > 0 && lay->weights.buffer != NULL) { //Prüfung ob dimensionen > 0 & Datenpuffer existiert
|
||||
// Schreibe alle MatrixType-Elemente (z.B. floats) der Gewichte, Anzahl usw.
|
||||
fwrite(lay->weights.buffer, sizeof(MatrixType), weightCount, file);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user