Procházet zdrojové kódy

Fix grid hashing (#142)

Conversion of numpy array to string outputs truncated string (different grids result in the same hash)
Vladislav Kurenkov před 3 roky
rodič
revize
6f5fe8588d
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. 1 1
      gym_minigrid/minigrid.py

+ 1 - 1
gym_minigrid/minigrid.py

@@ -742,7 +742,7 @@ class MiniGridEnv(gym.Env):
         """
         sample_hash = hashlib.sha256()
 
-        to_encode = [self.grid.encode(), self.agent_pos, self.agent_dir]
+        to_encode = [self.grid.encode().tolist(), self.agent_pos, self.agent_dir]
         for item in to_encode:
             sample_hash.update(str(item).encode('utf8'))