Browse Source

use the correct initialization for custom gym space

saleml 2 years ago
parent
commit
e782182d9b
1 changed files with 1 additions and 2 deletions
  1. 1 2
      gym_minigrid/minigrid.py

+ 1 - 2
gym_minigrid/minigrid.py

@@ -620,11 +620,10 @@ class StringGymSpace(gym.spaces.space.Space):
     A gym space that represents a string of characters of bounded length
     """
     def __init__(self, min_length=0, max_length=1000):
+        super().__init__(shape=(), dtype='U')
         self.min_length = min_length
         self.max_length = max_length
         self.letters = string.ascii_letters + string.digits + ' .,!- '
-        self._shape = ()
-        self.dtype = np.dtype('U')
 
     def sample(self):
         length = np.random.randint(self.min_length, self.max_length)