static void test_backprop_save_load() { bp net1, net2; int no_of_inputs=10; int no_of_hiddens=4; int no_of_outputs=3; int hidden_layers=3; int retval; unsigned int random_seed = 123; char filename[256]; FILE * fp; printf("test_backprop_save_load..."); /* create network */ bp_init(&net1, no_of_inputs, no_of_hiddens, hidden_layers, no_of_outputs, &random_seed); sprintf(filename,"%stemp_deep.dat",DEEPLEARN_TEMP_DIRECTORY); /* save the first network */ fp = fopen(filename,"wb"); assert(fp!=0); bp_save(fp, &net1); fclose(fp); /* load into the second network */ fp = fopen(filename,"rb"); assert(fp!=0); bp_load(fp, &net2, &random_seed); fclose(fp); /* compare the two */ retval = bp_compare(&net1, &net2); if (retval<1) { printf("\nretval = %d\n",retval); } assert(retval==1); /* free memory */ bp_free(&net1); bp_free(&net2); printf("Ok\n"); }
int bpx_compare(TERM t1, TERM t2) { return bp_compare(t1, t2); }