瀏覽代碼

Fix grid hashing (#142)

Conversion of numpy array to string outputs truncated string (different grids result in the same hash)
Vladislav Kurenkov 3 年之前
父節點
當前提交
6f5fe8588d
共有 1 個文件被更改,包括 1 次插入1 次删除
  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'))