瀏覽代碼

add `.spaces` when creating a new Dict space

saleml 2 年之前
父節點
當前提交
a146321d8f
共有 1 個文件被更改,包括 6 次插入6 次删除
  1. 6 6
      gym_minigrid/wrappers.py

+ 6 - 6
gym_minigrid/wrappers.py

@@ -137,7 +137,7 @@ class OneHotPartialObsWrapper(gym.ObservationWrapper):
             dtype='uint8'
             dtype='uint8'
         )
         )
         self.observation_space = spaces.Dict(
         self.observation_space = spaces.Dict(
-            {**self.observation_space, 'image': new_image_space})
+            {**self.observation_space.spaces, 'image': new_image_space})
 
 
     def observation(self, obs):
     def observation(self, obs):
         img = obs['image']
         img = obs['image']
@@ -180,7 +180,7 @@ class RGBImgObsWrapper(gym.ObservationWrapper):
         )
         )
 
 
         self.observation_space = spaces.Dict(
         self.observation_space = spaces.Dict(
-            {**self.observation_space, 'image': new_image_space})
+            {**self.observation_space.spaces, 'image': new_image_space})
 
 
     def observation(self, obs):
     def observation(self, obs):
         env = self.unwrapped
         env = self.unwrapped
@@ -217,7 +217,7 @@ class RGBImgPartialObsWrapper(gym.ObservationWrapper):
         )
         )
 
 
         self.observation_space = spaces.Dict(
         self.observation_space = spaces.Dict(
-            {**self.observation_space, 'image': new_image_space})
+            {**self.observation_space.spaces, 'image': new_image_space})
 
 
     def observation(self, obs):
     def observation(self, obs):
         env = self.unwrapped
         env = self.unwrapped
@@ -249,7 +249,7 @@ class FullyObsWrapper(gym.ObservationWrapper):
         )
         )
 
 
         self.observation_space = spaces.Dict(
         self.observation_space = spaces.Dict(
-            {**self.observation_space, 'image': new_image_space})
+            {**self.observation_space.spaces, 'image': new_image_space})
 
 
     def observation(self, obs):
     def observation(self, obs):
         env = self.unwrapped
         env = self.unwrapped
@@ -419,7 +419,7 @@ class ViewSizeWrapper(gym.Wrapper):
 
 
         # Override the environment's observation spaceexit
         # Override the environment's observation spaceexit
         self.observation_space = spaces.Dict(
         self.observation_space = spaces.Dict(
-            {**self.observation_space, 'image': new_image_space})
+            {**self.observation_space.spaces, 'image': new_image_space})
 
 
     def observation(self, obs):
     def observation(self, obs):
         env = self.unwrapped
         env = self.unwrapped
@@ -482,7 +482,7 @@ class SymbolicObsWrapper(gym.ObservationWrapper):
             dtype="uint8",
             dtype="uint8",
         )
         )
         self.observation_space = spaces.Dict(
         self.observation_space = spaces.Dict(
-            {**self.observation_space, 'image': new_image_space})
+            {**self.observation_space.spaces, 'image': new_image_space})
 
 
     def observation(self, obs):
     def observation(self, obs):
         objects = np.array(
         objects = np.array(