Saves calling tf.reduce_mean on all values once.

This commit is contained in:
Alexander Munch-Hansen 2018-05-10 22:57:27 +02:00
parent 4fa10861bb
commit 3b57c10b5a

View File

@ -321,12 +321,13 @@ class Network:
print(time.time() - start)
start = time.time()
# Running data through networks
all_scores = [self.model.predict_on_batch(board) for board in list_of_moves]
transformed_scores = [x if player == 1 else (1-x) for x in all_scores]
scores_means = [tf.reduce_mean(score) for score in all_scores]
transformed_means = [tf.reduce_mean(score) for score in transformed_scores]
transformed_means = [x if player == 1 else (1-x) for x in scores_means]
print(time.time() - start)
return ([scores_means, transformed_means])