1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
void CBackProp::saveWeight(char * filename){
int i,j,k;
ofstream sypnaOutfile(filename, ios::out | ios::binary);
if(!sypnaOutfile){
cout<<"Impossible de créer le fichier"<<endl;
exit(-1);
}
for(i=1;i<3;i++)
for(j=0;j<lsize[i];j++)
for(k=0;k<lsize[i-1]+1;k++){
sypnaOutfile << weight[i][j][k];
// weight[i][j][k]= (double)(rand())/(RAND_MAX/2) - 1;//32767
//fichier >> weight[i][j][k];
//outFile <<val;
//cout<<weight[i][j][k]<<endl;
}
}
void CBackProp::loadWeight(char * filename){
int i,j,k;
ifstream sypnaInfile(filename, ios::in | ios::binary);
if(!sypnaInfile){
cout<<"Le fichier d'entrée n'existe pas"<<endl;
exit(-1);
}
for(i=1;i<3;i++)
for(j=0;j<lsize[i];j++)
for(k=0;k<lsize[i-1]+1;k++){
sypnaInfile >> weight[i][j][k];
// weight[i][j][k]= (double)(rand())/(RAND_MAX/2) - 1;//32767
//fichier >> weight[i][j][k];
//outFile <<val;
cout<<weight[i][j][k]<<endl;
}
} |
Partager