Saves calling tf.reduce_mean on all values once.
This commit is contained in:
parent
4fa10861bb
commit
3b57c10b5a
|
@ -321,12 +321,13 @@ class Network:
|
||||||
print(time.time() - start)
|
print(time.time() - start)
|
||||||
|
|
||||||
start = time.time()
|
start = time.time()
|
||||||
|
|
||||||
# Running data through networks
|
# Running data through networks
|
||||||
all_scores = [self.model.predict_on_batch(board) for board in list_of_moves]
|
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]
|
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)
|
print(time.time() - start)
|
||||||
return ([scores_means, transformed_means])
|
return ([scores_means, transformed_means])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user