shithub: util

Download patch

ref: 053b67a55eaad52c8ebd78a1908e2a913bded789
parent: 0d1b32b03e29555af52ab0acec0c6b38dd342f49
author: eli <eli@singularity>
date: Tue Dec 24 12:09:23 EST 2024

run output on train. output to stdout

--- a/ann.c
+++ b/ann.c
@@ -702,6 +702,7 @@
 	char *line;
 	double *input;
 	double *output = nil;
+	double *runoutput;
 	int ninput;
 	int noutput;
 	int offset;
@@ -810,12 +811,14 @@
 			} while(i < nline && strlen(line) > 0);
 
 			if (i == nline) {
-				if (train == 0) {
-					output = annrun(ann, input);
+				if (trainline == 0) {
+					runoutput = annrun(ann, input);
 					for (i = 0; i < noutput; i++)
-						fprint(2, "%f%c", output[i], (i == (noutput-1))? '\n': ' ');
-					free(output);
-				} else {
+						print("%f%c", runoutput[i], (i == (noutput-1))? '\n': ' ');
+					free(runoutput);
+				}
+
+				if (train == 1) {
 					if (trainline == 0) {
 						trainline = 1;
 						nline = noutput;
--