Lines Matching refs:topo
46 MLPTrain * mlp_init(int *topo, int nbLayers, float *inputs, float *outputs, int nbSamples) in mlp_init() argument
52 net->topo = malloc(nbLayers*sizeof(net->topo[0])); in mlp_init()
54 net->topo[i] = topo[i]; in mlp_init()
55 inDim = topo[0]; in mlp_init()
56 outDim = topo[nbLayers-1]; in mlp_init()
62 net->weights[i] = malloc((topo[i]+1)*topo[i+1]*sizeof(net->weights[0][0])); in mlp_init()
63 net->best_weights[i] = malloc((topo[i]+1)*topo[i+1]*sizeof(net->weights[0][0])); in mlp_init()
82 for (k=0;k<topo[1];k++) in mlp_init()
83 net->weights[0][k*(topo[0]+1)+j+1] = randn(std); in mlp_init()
86 for (j=0;j<topo[1];j++) in mlp_init()
90 sum += inMean[k]*net->weights[0][j*(topo[0]+1)+k+1]; in mlp_init()
91 net->weights[0][j*(topo[0]+1)] = -sum; in mlp_init()
100 std = 1/sqrt(topo[nbLayers-2]); in mlp_init()
101 net->weights[nbLayers-2][j*(topo[nbLayers-2]+1)] = mean; in mlp_init()
102 for (k=0;k<topo[nbLayers-2];k++) in mlp_init()
103 net->weights[nbLayers-2][j*(topo[nbLayers-2]+1)+k+1] = randn(std); in mlp_init()
116 int *topo; in compute_gradient() local
124 topo = net->topo; in compute_gradient()
125 inDim = net->topo[0]; in compute_gradient()
126 hiddenDim = net->topo[1]; in compute_gradient()
127 outDim = net->topo[2]; in compute_gradient()
128 W0_size = (topo[0]+1)*topo[1]; in compute_gradient()
129 W1_size = (topo[1]+1)*topo[2]; in compute_gradient()
206 int *topo = arg->net->topo; in gradient_thread_process() local
207 W0_size = (topo[0]+1)*topo[1]; in gradient_thread_process()
208 W1_size = (topo[1]+1)*topo[2]; in gradient_thread_process()
231 int *topo; in mlp_train_backprop() local
240 topo = net->topo; in mlp_train_backprop()
241 W0_size = (topo[0]+1)*topo[1]; in mlp_train_backprop()
242 W1_size = (topo[1]+1)*topo[2]; in mlp_train_backprop()
249 topo = net->topo; in mlp_train_backprop()
250 inDim = net->topo[0]; in mlp_train_backprop()
251 hiddenDim = net->topo[1]; in mlp_train_backprop()
252 outDim = net->topo[2]; in mlp_train_backprop()
399 mean_rate /= (topo[0]+1)*topo[1] + (topo[1]+1)*topo[2]; in mlp_train_backprop()
471 int topo[3] = {nbInputs, nbHidden, nbOutputs}; in main() local
475 net = mlp_init(topo, 3, inputs, outputs, nbSamples); in main()
479 printf ("static const float weights[%d] = {\n", (topo[0]+1)*topo[1] + (topo[1]+1)*topo[2]); in main()
481 for (i=0;i<(topo[0]+1)*topo[1];i++) in main()
488 for (i=0;i<(topo[1]+1)*topo[2];i++) in main()
495 printf ("static const int topo[3] = {%d, %d, %d};\n\n", topo[0], topo[1], topo[2]); in main()