shithub: opus

Download patch

ref: a599ccd2172c159cb690a8b446bb4b3986d594fb
parent: 5174817d3627fe740d3903b341dafa7109d44be8
author: Jean-Marc Valin <[email protected]>
date: Fri Nov 8 16:47:44 EST 2013

stupid uninitialized variable in the mlp training caught by cppcheck

--- a/src/mlp_train.c
+++ b/src/mlp_train.c
@@ -121,8 +121,6 @@
 	double netOut[MAX_NEURONS];
 	double error[MAX_NEURONS];
 
-	for (i=0;i<outDim;i++)
-	   error_rate[i] = 0;
 	topo = net->topo;
 	inDim = net->topo[0];
 	hiddenDim = net->topo[1];
@@ -135,6 +133,8 @@
 	memset(W1_grad, 0, W1_size*sizeof(double));
 	for (i=0;i<outDim;i++)
 		netOut[i] = outputs[i];
+	for (i=0;i<outDim;i++)
+	   error_rate[i] = 0;
 	for (s=0;s<nbSamples;s++)
 	{
 		float *in, *out;