Skip to content

Commit

Permalink
more go
Browse files Browse the repository at this point in the history
  • Loading branch information
pjreddie committed Mar 16, 2016
1 parent cff59ba commit 67794a5
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/go.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void flip_board(float *board)
}
}

void test_go(char *filename, char *weightfile)
void test_go(char *filename, char *weightfile, int multi)
{
network net = parse_network_cfg(filename);
if(weightfile){
Expand All @@ -191,25 +191,25 @@ void test_go(char *filename, char *weightfile)
float *output = network_predict(net, board);
copy_cpu(19*19, output, 1, move, 1);
int i;
#ifdef GPU
image bim = float_to_image(19, 19, 1, board);
for(i = 1; i < 8; ++i){
rotate_image_cw(bim, i);
if(i >= 4) flip_image(bim);
if(multi){
image bim = float_to_image(19, 19, 1, board);
for(i = 1; i < 8; ++i){
rotate_image_cw(bim, i);
if(i >= 4) flip_image(bim);

float *output = network_predict(net, board);
image oim = float_to_image(19, 19, 1, output);
float *output = network_predict(net, board);
image oim = float_to_image(19, 19, 1, output);

if(i >= 4) flip_image(oim);
rotate_image_cw(oim, -i);
if(i >= 4) flip_image(oim);
rotate_image_cw(oim, -i);

axpy_cpu(19*19, 1, output, 1, move, 1);
axpy_cpu(19*19, 1, output, 1, move, 1);

if(i >= 4) flip_image(bim);
rotate_image_cw(bim, -i);
if(i >= 4) flip_image(bim);
rotate_image_cw(bim, -i);
}
scal_cpu(19*19, 1./8., move, 1);
}
scal_cpu(19*19, 1./8., move, 1);
#endif
for(i = 0; i < 19*19; ++i){
if(board[i]) move[i] = 0;
}
Expand Down Expand Up @@ -282,8 +282,9 @@ void run_go(int argc, char **argv)

char *cfg = argv[3];
char *weights = (argc > 4) ? argv[4] : 0;
int multi = find_arg(argc, argv, "-multi");
if(0==strcmp(argv[2], "train")) train_go(cfg, weights);
else if(0==strcmp(argv[2], "test")) test_go(cfg, weights);
else if(0==strcmp(argv[2], "test")) test_go(cfg, weights, multi);
}


0 comments on commit 67794a5

Please sign in to comment.