diff --git a/network.py b/network.py index 00e405e..f299e50 100644 --- a/network.py +++ b/network.py @@ -312,7 +312,7 @@ class Network: # start = time.time() list_of_moves = [] - + test_list = [] # Prepping of data for idx, board in enumerate(boards): all_board_moves = [] @@ -321,16 +321,41 @@ class Network: for state in all_states: state = np.array(self.board_trans_func(state, player*-1)[0]) all_board_moves.append(state) + test_list.append(state) list_of_moves.append(np.array(all_board_moves)) - # print(time.time() - start) - # start = time.time() + list_of_lengths = [len(board) for board in list_of_moves] - # Running data through networks + start = time.time() + for i in range(len(test_list)): + self.model.predict_on_batch(np.array([state])) + print("Indiviual rolls:", time.time() - start) all_scores = [self.model.predict_on_batch(board) for board in list_of_moves] + + + start = time.time() + all_scores_legit = self.model.predict_on_batch(np.array(test_list)) + + split_scores = [] + from_idx = 0 + for length in list_of_lengths: + split_scores.append(all_scores_legit[from_idx:from_idx+length]) + from_idx += length + + transformed_splits = [tf.reduce_mean(scores) for scores in split_scores] + + print(transformed_splits) + + + + + print("All in one:", time.time() - start) + scores_means = [tf.reduce_mean(score) for score in all_scores] + print(scores_means) + transformed_means = [x if player == 1 else (1-x) for x in scores_means] # print(time.time() - start)