Maxime Chevalier-Boisvert преди 6 години
родител
ревизия
728353777f
променени са 1 файла, в които са добавени 2 реда и са изтрити 6 реда
  1. 2 6
      gym_minigrid/rendering.py

+ 2 - 6
gym_minigrid/rendering.py

@@ -138,17 +138,13 @@ class Renderer:
     def getArray(self):
     def getArray(self):
         """
         """
         Get a numpy array of RGB pixel values.
         Get a numpy array of RGB pixel values.
-        The size argument should be (3,w,h)
+        The array will have shape (height, width, 3)
         """
         """
 
 
-        width = self.width
-        height = self.height
-        shape = (width, height, 3)
-
         numBytes = self.width * self.height * 3
         numBytes = self.width * self.height * 3
         buf = self.img.bits().asstring(numBytes)
         buf = self.img.bits().asstring(numBytes)
         output = np.frombuffer(buf, dtype='uint8')
         output = np.frombuffer(buf, dtype='uint8')
-        output = output.reshape(shape)
+        output = output.reshape((height, width, 3))
 
 
         return output
         return output