Skip to content

Commit c6512aa

Browse files
committed
fix issue #3
1 parent 76dd7d3 commit c6512aa

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/nn.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "nn.hh"
2323

2424
#include <sstream>
25+
#include <algorithm>
2526

2627
using namespace v8;
2728
using namespace node;
@@ -449,7 +450,7 @@ void NN::mt_train(double error = 0.01,
449450
//cout << endl << "IT[" << it << "] Step " << step << endl;
450451
//cout << "Initializing children NNs... ";
451452
/* Copy and initialize children NN */
452-
NN* nns[thread];
453+
NN** nns = new NN*[thread];
453454
for(int i = 0; i < thread; i++) {
454455
nns[i] = new NN(*this);
455456
nns[i]->train_set_clear();
@@ -471,8 +472,8 @@ void NN::mt_train(double error = 0.01,
471472

472473
/* Launch threads */
473474
//cout << "Launch threads... ";
474-
uv_thread_t nns_ids[n_thread];
475-
MT_NN::LearnWorker *workers[n_thread];
475+
uv_thread_t* nns_ids = new uv_thread_t[n_thread];
476+
MT_NN::LearnWorker** workers = new MT_NN::LearnWorker*[n_thread];
476477
for(int i = 0; i < n_thread; i++) {
477478
workers[i] = new MT_NN::LearnWorker();
478479
workers[i]->nn = nns[i];
@@ -1076,7 +1077,7 @@ int MT_NN::split_data(NN** nns, int no_nns, int step, int step_size,
10761077
vector< vector<double> > train_out)
10771078
{
10781079
unsigned int total = 0;
1079-
int max_to_insert = min((step + 1) * no_nns * step_size,
1080+
int max_to_insert = std::min((step + 1) * no_nns * step_size,
10801081
(int)train_in.size());
10811082
int to_insert = 0;
10821083

0 commit comments

Comments
 (0)