From 992306b03154e1b799b3c757dc1caa2f1bce631b Mon Sep 17 00:00:00 2001 From: Tclack88 <39845330+Tclack88@users.noreply.github.com> Date: Mon, 9 Mar 2020 09:45:50 -0700 Subject: [PATCH] Update classifier.c declaring variables not allowed within `for loops` until C99. additionally. declaring int i multiple times within the same definition try_classifier isn't necessary --- src/classifier.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/classifier.c b/src/classifier.c index 27aafad2..7600d2c6 100644 --- a/src/classifier.c +++ b/src/classifier.c @@ -753,13 +753,14 @@ void try_classifier(char *datacfg, char *cfgfile, char *weightfile, char *filena float *predictions = network_predict(net, X); layer l = net.layers[layer_num]; - for(int i = 0; i < l.c; ++i){ + int i; + for(i = 0; i < l.c; ++i){ if(l.rolling_mean) printf("%f %f %f\n", l.rolling_mean[i], l.rolling_variance[i], l.scales[i]); } #ifdef GPU cuda_pull_array(l.output_gpu, l.output, l.outputs); #endif - for(int i = 0; i < l.outputs; ++i){ + for(i = 0; i < l.outputs; ++i){ printf("%f\n", l.output[i]); } /* @@ -777,7 +778,7 @@ void try_classifier(char *datacfg, char *cfgfile, char *weightfile, char *filena top_predictions(net, top, indexes); printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time)); - for(int i = 0; i < top; ++i){ + for(i = 0; i < top; ++i){ int index = indexes[i]; printf("%s: %f\n", names[index], predictions[index]); }