Skip to content

Commit

Permalink
[NumPy] Remove references to deprecated NumPy type aliases.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hawkinsp authored and diegolascasas committed Jan 31, 2023
1 parent ea77295 commit 4caaad8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ogb_lsc/mag/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down
2 changes: 1 addition & 1 deletion physics_planning_games/board_games/go_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def get_board_state(self):
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]]
Expand Down
2 changes: 1 addition & 1 deletion physics_planning_games/board_games/tic_tac_toe_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def get_board_state(self):
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]]
Expand Down

0 comments on commit 4caaad8

Please sign in to comment.