mirror of
https://github.com/augustin64/projet-tipe
synced 2025-01-23 23:26:25 +01:00
Update the way of reading the network
This commit is contained in:
parent
c78c8a0ade
commit
6917711271
@ -32,7 +32,7 @@ void write_network(char* filename, Network* network) {
|
||||
bufferAdd(network->depth[i]);
|
||||
}
|
||||
|
||||
for (int i=0; i < size; i++) {
|
||||
for (int i=0; i < size-1; i++) {
|
||||
if ((!network->kernel[i]->cnn)&&(!network->kernel[i]->nn)) {
|
||||
type_couche[i] = 2;
|
||||
} else if (!network->kernel[i]->cnn) {
|
||||
@ -46,7 +46,7 @@ void write_network(char* filename, Network* network) {
|
||||
fwrite(buffer, sizeof(buffer), 1, ptr);
|
||||
|
||||
// Écriture du pré-corps et corps
|
||||
for (int i=0; i < size; i++) {
|
||||
for (int i=0; i < size-1; i++) {
|
||||
write_couche(network, i, type_couche[i], ptr);
|
||||
}
|
||||
|
||||
@ -168,12 +168,11 @@ Network* read_network(char* filename) {
|
||||
}
|
||||
|
||||
// Lecture de chaque couche
|
||||
network->kernel = (Kernel**)malloc(sizeof(Kernel*)*size);
|
||||
network->kernel = (Kernel**)malloc(sizeof(Kernel*)*(size-1));
|
||||
|
||||
for (int i=0; i < (int)size-1; i++) {
|
||||
network->kernel[i] = read_kernel(type_couche[i], network->width[i+1], ptr);
|
||||
}
|
||||
network->kernel[(int)size-1] = read_kernel(type_couche[(int)size-1], -1, ptr);
|
||||
|
||||
network->input = (float****)malloc(sizeof(float***)*size);
|
||||
for (int i=0; i < (int)size; i++) { // input[size][couche->depth][couche->dim][couche->dim]
|
||||
|
@ -40,7 +40,7 @@ bool equals_networks(Network* network1, Network* network2) {
|
||||
checkEquals(depth[i], "input_depth", i);
|
||||
}
|
||||
|
||||
for (int i=0; i < network1->size; i++) {
|
||||
for (int i=0; i < network1->size-1; i++) {
|
||||
checkEquals(kernel[i]->activation, "kernel[i]->activation", i);
|
||||
if ((!network1->kernel[i]->cnn ^ !network2->kernel[i]->cnn) || (!network1->kernel[i]->nn ^ !network2->kernel[i]->nn)) {
|
||||
printf(BOLDRED "[ ERROR ]" RESET "network1->kernel[%d] et network1->kernel[%d] diffèrent de type\n", i, i);
|
||||
@ -118,8 +118,8 @@ Network* copy_network(Network* network) {
|
||||
copyVar(depth[i]);
|
||||
}
|
||||
|
||||
network_cp->kernel = (Kernel**)malloc(sizeof(Kernel*)*size);
|
||||
for (int i=0; i < size; i++) {
|
||||
network_cp->kernel = (Kernel**)malloc(sizeof(Kernel*)*(size-1));
|
||||
for (int i=0; i < size-1; i++) {
|
||||
network_cp->kernel[i] = (Kernel*)malloc(sizeof(Kernel));
|
||||
if (!network->kernel[i]->nn && !network->kernel[i]->cnn) { // Cas de la couche de linéarisation
|
||||
copyVar(kernel[i]->activation);
|
||||
|
Loading…
Reference in New Issue
Block a user