Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation warnings #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

RohanM
Copy link

@RohanM RohanM commented May 1, 2022

There are a few deprecation warnings from scipy and numpy that clutter the output. Let's clean them up.

Example shell output
❯ python gym_go/tests/test_basics.py
/Users/rohanmitchell/dev/GymGo/gym_go/state_utils.py:166: DeprecationWarning: Please use `label` from the `scipy.ndimage` namespace, the `scipy.ndimage.measurements` namespace is deprecated.
  all_opp_groups, _ = ndimage.measurements.label(state[opponent])
/Users/rohanmitchell/dev/GymGo/gym_go/state_utils.py:48: DeprecationWarning: Please use `label` from the `scipy.ndimage` namespace, the `scipy.ndimage.measurements` namespace is deprecated.
  all_own_groups, num_own_groups = measurements.label(state[player])
/Users/rohanmitchell/dev/GymGo/gym_go/state_utils.py:49: DeprecationWarning: Please use `label` from the `scipy.ndimage` namespace, the `scipy.ndimage.measurements` namespace is deprecated.
  all_opp_groups, num_opp_groups = measurements.label(state[1 - player])
../Users/rohanmitchell/dev/GymGo/gym_go/gogame.py:250: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  return np.max(batch_state[:, govars.TURN_CHNL], axis=(1, 2)).astype(np.int)
/Users/rohanmitchell/dev/GymGo/gym_go/state_utils.py:190: DeprecationWarning: Please use `label` from the `scipy.ndimage` namespace, the `scipy.ndimage.measurements` namespace is deprecated.
  batch_all_opp_groups, _ = ndimage.measurements.label(batch_state[batch_non_pass, batch_opponent],
/Users/rohanmitchell/dev/GymGo/gym_go/state_utils.py:111: DeprecationWarning: Please use `label` from the `scipy.ndimage` namespace, the `scipy.ndimage.measurements` namespace is deprecated.
  batch_all_own_groups, _ = measurements.label(batch_state[batch_idcs, batch_player], group_struct)
/Users/rohanmitchell/dev/GymGo/gym_go/state_utils.py:112: DeprecationWarning: Please use `label` from the `scipy.ndimage` namespace, the `scipy.ndimage.measurements` namespace is deprecated.
  batch_all_opp_groups, _ = measurements.label(batch_state[batch_idcs, 1 - batch_player], group_struct)
.../Users/rohanmitchell/dev/GymGo/gym_go/gogame.py:283: DeprecationWarning: Please use `label` from the `scipy.ndimage` namespace, the `scipy.ndimage.measurements` namespace is deprecated.
  empty_labels, num_empty_areas = ndimage.measurements.label(empties)
..../Users/rohanmitchell/dev/GymGo/gym_go/gogame.py:261: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  liberties *= (1 - all_pieces).astype(np.bool)

@RohanM RohanM marked this pull request as ready for review May 1, 2022 02:38
@RohanM RohanM mentioned this pull request May 3, 2022
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant