From b408067d9ad6fe26a4396408f3f4e823c8025baa Mon Sep 17 00:00:00 2001 From: NM512 Date: Sun, 18 Jun 2023 17:18:24 +0900 Subject: [PATCH] avoid DeprecationWarning --- envs/memorymaze.py | 6 +++--- envs/wrappers.py | 4 ++-- requirements.txt | 3 ++- tools.py | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/envs/memorymaze.py b/envs/memorymaze.py index 09603a3..531ebc0 100644 --- a/envs/memorymaze.py +++ b/envs/memorymaze.py @@ -36,9 +36,9 @@ class MemoryMaze: return { **spaces, "reward": gym.spaces.Box(-np.inf, np.inf, (), dtype=np.float32), - "is_first": gym.spaces.Box(0, 1, (), dtype=np.bool), - "is_last": gym.spaces.Box(0, 1, (), dtype=np.bool), - "is_terminal": gym.spaces.Box(0, 1, (), dtype=np.bool), + "is_first": gym.spaces.Box(0, 1, (), dtype=bool), + "is_last": gym.spaces.Box(0, 1, (), dtype=bool), + "is_terminal": gym.spaces.Box(0, 1, (), dtype=bool), } @property diff --git a/envs/wrappers.py b/envs/wrappers.py index c94b8e9..da80837 100644 --- a/envs/wrappers.py +++ b/envs/wrappers.py @@ -77,8 +77,8 @@ class CollectDataset: dtype = {16: np.int16, 32: np.int32, 64: np.int64}[self._precision] elif np.issubdtype(value.dtype, np.uint8): dtype = np.uint8 - elif np.issubdtype(value.dtype, np.bool): - dtype = np.bool + elif np.issubdtype(value.dtype, bool): + dtype = bool else: raise NotImplementedError(value.dtype) return value.astype(dtype) diff --git a/requirements.txt b/requirements.txt index 5b82ad3..934d685 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,4 +9,5 @@ moviepy==1.0.3 einops==0.3.0 protobuf==3.20.0 gym==0.19.0 -dm_control==1.0.9 \ No newline at end of file +dm_control==1.0.9 +scipy==scipy==1.9.0 \ No newline at end of file diff --git a/tools.py b/tools.py index 8b52379..14aa42d 100644 --- a/tools.py +++ b/tools.py @@ -127,7 +127,7 @@ def simulate(agent, envs, steps=0, episodes=0, state=None): # Initialize or unpack simulation state. if state is None: step, episode = 0, 0 - done = np.ones(len(envs), np.bool) + done = np.ones(len(envs), bool) length = np.zeros(len(envs), np.int32) obs = [None] * len(envs) agent_state = None