mirror of
https://github.com/google-deepmind/deepmind-research.git
synced 2026-05-26 01:15:26 +08:00
[NumPy] Remove references to deprecated NumPy type aliases.
This change replaces references to a number of deprecated NumPy type aliases (np.bool, np.int, np.float, np.complex, np.object, np.str) with their recommended replacement (bool, int, float, complex, object, str). NumPy 1.24 drops the deprecated aliases, so we must remove uses before updating NumPy. PiperOrigin-RevId: 495851585
This commit is contained in:
committed by
Diego de las Casas
parent
ea772958de
commit
4caaad8b0a
@@ -380,7 +380,7 @@ def generate_fused_paper_adjacency_matrix(neighbor_indices, neighbor_distances,
|
||||
new_rows = np.concatenate(new_rows)
|
||||
new_cols = np.concatenate(new_cols)
|
||||
return sp.coo_matrix(
|
||||
(np.ones_like(new_rows, dtype=np.bool), (new_rows, new_cols)),
|
||||
(np.ones_like(new_rows, dtype=bool), (new_rows, new_cols)),
|
||||
shape=paper_paper_coo_shape).tocsr()
|
||||
|
||||
|
||||
|
||||
@@ -388,7 +388,7 @@ class GoGameLogic(logic_base.OpenSpielBasedLogic):
|
||||
always all the same value indicating whether white is to play).
|
||||
"""
|
||||
board_state = np.reshape(
|
||||
np.array(self._open_spiel_state.observation_tensor(0), dtype=np.bool),
|
||||
np.array(self._open_spiel_state.observation_tensor(0), dtype=bool),
|
||||
[4, self._board_size, self._board_size])
|
||||
board_state = np.transpose(board_state, [1, 2, 0])
|
||||
board_state = board_state[:, :, [2, 0, 1, 3]]
|
||||
|
||||
@@ -62,7 +62,7 @@ class TicTacToeGameLogic(logic_base.OpenSpielBasedLogic):
|
||||
unmarked squares, x's (player 0) and y's (player 1).
|
||||
"""
|
||||
board_state = np.reshape(
|
||||
np.array(self._open_spiel_state.observation_tensor(0), dtype=np.bool),
|
||||
np.array(self._open_spiel_state.observation_tensor(0), dtype=bool),
|
||||
[3, 3, 3])
|
||||
board_state = np.transpose(board_state, [1, 2, 0])
|
||||
board_state = board_state[:, :, [0, 2, 1]]
|
||||
|
||||
Reference in New Issue
Block a user