Listing 4: Code to implement the backpropagation "working"
mode
/*********************************
*
* Working
*
**********************************/
if( (strncmp(mode, "working", 3) == 0)){
in_file = open_file(in_file_name, "r+b");
out_file = open_file(out_file_name,"w+b");
win_file = open_file(win_file_name, "r+b");
whid_file = open_file(whid_file_name, "r+b");
wout_file = open_file(wout_file_name, "r+b");
read_from_file(x, m, in_file);
read_from_file(win, m*p, win_file);
read_from_file(whid, (n-1)*p*p, whid_file);
read_from_file(wout, p*o, wout_file);
input_layer(h, x, win, m, p, n, type);
inner_layers(h, whid, p, n, type);
output_layer(h, wout, y, p, n, o, type);
printf("\nThe input was");
display_2d_weights(x, 1, m);
printf("\n\nResults: (output)");
display_2d_weights(y, 1, o);
write_to_file(y, o, out_file);
fclose(in_file);
fclose(out_file);
fclose(win_file);
fclose(whid_file);
fclose(wout_file);
} /* ends if working */