Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion cpp/command/runtests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,28 @@ int MainCmds::runoutputtests(const vector<string>& args) {
return 0;
}

int MainCmds::runpersistentmctstests(const vector<string>& args) {
(void)args;
Board::initHash();
ScoreValue::initTables();

Tests::runPersistentMCTSTests();

ScoreValue::freeTables();
return 0;
}

int MainCmds::runpersistentmctsstricttests(const vector<string>& args) {
(void)args;
Board::initHash();
ScoreValue::initTables();

Tests::runPersistentMCTSStrictTests();

ScoreValue::freeTables();
return 0;
}

int MainCmds::runsearchtests(const vector<string>& args) {
Board::initHash();
ScoreValue::initTables();
Expand Down Expand Up @@ -773,4 +795,3 @@ int MainCmds::runconfigtests(const vector<string>& args) {
Tests::runParseAllConfigsTest();
return 0;
}

6 changes: 6 additions & 0 deletions cpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ runnnsymmetriestest : Run neural net on a hardcoded rectangle board and dump sym
runownershiptests : Run neural net search on some hardcoded positions and print avg ownership

runoutputtests : Run a bunch of things and dump details to stdout
runpersistentmctstests : Run persistent MCTS correctness tests
runpersistentmctsstricttests : Run strict persistent MCTS SGF alignment tests
runsearchtests : Run a bunch of things using a neural net and dump details to stdout
runsearchtestsv3 : Run a bunch more things using a neural net and dump details to stdout
runsearchtestsv8 : Run a bunch more things using a neural net and dump details to stdout
Expand Down Expand Up @@ -103,6 +105,10 @@ static int handleSubcommand(const string& subcommand, const vector<string>& args
return MainCmds::runownershiptests(subArgs);
else if(subcommand == "runoutputtests")
return MainCmds::runoutputtests(subArgs);
else if(subcommand == "runpersistentmctstests")
return MainCmds::runpersistentmctstests(subArgs);
else if(subcommand == "runpersistentmctsstricttests")
return MainCmds::runpersistentmctsstricttests(subArgs);
else if(subcommand == "runsearchtests")
return MainCmds::runsearchtests(subArgs);
else if(subcommand == "runsearchtestsv3")
Expand Down
2 changes: 2 additions & 0 deletions cpp/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ namespace MainCmds {
int runnnontinyboardtest(const std::vector<std::string>& args);
int runnnsymmetriestest(const std::vector<std::string>& args);
int runoutputtests(const std::vector<std::string>& args);
int runpersistentmctstests(const std::vector<std::string>& args);
int runpersistentmctsstricttests(const std::vector<std::string>& args);
int runsearchtests(const std::vector<std::string>& args);
int runsearchtestsv3(const std::vector<std::string>& args);
int runsearchtestsv8(const std::vector<std::string>& args);
Expand Down
23 changes: 15 additions & 8 deletions cpp/neuralnet/nneval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ NNResultBuf::NNResultBuf()
includeOwnerMap(false),
boardXSizeForServer(0),
boardYSizeForServer(0),
nnHashForServer(),
rowSpatialBuf(),
rowGlobalBuf(),
rowMetaBuf(),
Expand Down Expand Up @@ -613,6 +614,11 @@ void NNEvaluator::serve(
testAssert(resultBuf->hasResult == false);
resultBuf->result = std::make_shared<NNOutput>();

string deterministicSeedBase = randSeed + ":DebugSkip:" + resultBuf->nnHashForServer.toString();
Rand policyRand(deterministicSeedBase + ":Policy");
Rand ownerRand(deterministicSeedBase + ":Owner");
Rand valueRand(deterministicSeedBase + ":Value");

float* policyProbs = resultBuf->result->policyProbs;
for(int i = 0; i<NNPos::MAX_NN_POLICY_SIZE; i++)
policyProbs[i] = 0;
Expand All @@ -623,10 +629,10 @@ void NNEvaluator::serve(
for(int y = 0; y<boardYSize; y++) {
for(int x = 0; x<boardXSize; x++) {
int pos = NNPos::xyToPos(x,y,nnXLen);
policyProbs[pos] = (float)rand.nextGaussian();
policyProbs[pos] = (float)policyRand.nextGaussian();
}
}
policyProbs[NNPos::locToPos(Board::PASS_LOC,boardXSize,nnXLen,nnYLen)] = (float)rand.nextGaussian();
policyProbs[NNPos::locToPos(Board::PASS_LOC,boardXSize,nnXLen,nnYLen)] = (float)policyRand.nextGaussian();

resultBuf->result->nnXLen = nnXLen;
resultBuf->result->nnYLen = nnYLen;
Expand All @@ -637,7 +643,7 @@ void NNEvaluator::serve(
for(int y = 0; y<boardYSize; y++) {
for(int x = 0; x<boardXSize; x++) {
int pos = NNPos::xyToPos(x,y,nnXLen);
whiteOwnerMap[pos] = (float)rand.nextGaussian() * 0.20f;
whiteOwnerMap[pos] = (float)ownerRand.nextGaussian() * 0.20f;
}
}
resultBuf->result->whiteOwnerMap = whiteOwnerMap;
Expand All @@ -647,11 +653,11 @@ void NNEvaluator::serve(
}

// These aren't really probabilities. Win/Loss/NoResult will get softmaxed later
double whiteWinProb = 0.0 + rand.nextGaussian() * 0.20;
double whiteLossProb = 0.0 + rand.nextGaussian() * 0.20;
double whiteScoreMean = 0.0 + rand.nextGaussian() * 0.20;
double whiteScoreMeanSq = 0.0 + rand.nextGaussian() * 0.20;
double whiteNoResultProb = 0.0 + rand.nextGaussian() * 0.20;
double whiteWinProb = 0.0 + valueRand.nextGaussian() * 0.20;
double whiteLossProb = 0.0 + valueRand.nextGaussian() * 0.20;
double whiteScoreMean = 0.0 + valueRand.nextGaussian() * 0.20;
double whiteScoreMeanSq = 0.0 + valueRand.nextGaussian() * 0.20;
double whiteNoResultProb = 0.0 + valueRand.nextGaussian() * 0.20;
double varTimeLeft = 0.5 * boardXSize * boardYSize;
resultBuf->result->whiteWinProb = (float)whiteWinProb;
resultBuf->result->whiteLossProb = (float)whiteLossProb;
Expand Down Expand Up @@ -901,6 +907,7 @@ void NNEvaluator::evaluate(

buf.boardXSizeForServer = board.x_size;
buf.boardYSizeForServer = board.y_size;
buf.nnHashForServer = nnHash;

if(!debugSkipNeuralNet) {
fillRowBufs(board, history, nextPlayer, sgfMeta, nnInputParams, buf);
Expand Down
1 change: 1 addition & 0 deletions cpp/neuralnet/nneval.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct NNResultBuf {
bool includeOwnerMap;
int boardXSizeForServer;
int boardYSizeForServer;
Hash128 nnHashForServer;
std::vector<float> rowSpatialBuf;
std::vector<float> rowGlobalBuf;
std::vector<float> rowMetaBuf;
Expand Down
Loading