huangeddie / GymGo

An environment of the board game Go using OpenAI's Gym API
164 stars 31 forks source link

Fix deprecation warnings #19

Open RohanM opened 2 years ago

RohanM commented 2 years ago

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

Example shell output ```shell ❯ 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) ```