ymgaq/AQ

assertion occurs in Board::SelectMove

Closed this issue · 1 comments

I make a version (https://github.com/stevevista/AQ) using dlib as nn backend instead of tensorflow.
most of time, it runs ok. only once it goes to the assertion code in Board::SelectMove
tmp_sum -= **prob_rank[y];
assert(y < BSIZE);

Is is possible the incorrect NN prediction that cause it

ymgaq commented

Your implementation is very interesting.

BTW, the assertion is not caused by dlib. It is a known exception that is being ignored for improving rollout speed. It also occurs with TensorFlow.

Use -DNDEBUG option to ignore it, or modify the code as below.

//    Find the rank where sum of prob_rank exceeds rand_move.
for (y=0;y<BSIZE-1;++y) {
	tmp_sum += prob_rank[y];
	if (tmp_sum > rand_move){
		tmp_sum -= prob_rank[y];
		break;
	}
}
assert(y < BSIZE);

//    Find the position where sum of probability exceeds rand_move.
next_move = xytoe[1][y + 1];
for (x=0;x<BSIZE;++x) {
	tmp_sum += prob_v[next_move];
	if (tmp_sum > rand_move) break;
	++next_move;
}
//assert(x < BSIZE);