MCPcopy Create free account
hub / github.com/rlcode/reinforcement-learning / load_state

Method load_state

4-atari-hard/2-go-explore.py:182–193  ·  view source on GitHub ↗
(self, st)

Source from the content-addressed store, hash-verified

180 "cur_rew": self.rew[:self.fill].copy(), "cur_done": self.done[:self.fill].copy()}
181
182 def load_state(self, st):
183 assert st["chunk_size"] == self.chunk_size, "explog chunk_size mismatch"
184 if self.dir: # flushed chunks must be reachable (own dir or ancestor's)
185 self.n_flushed = st["n_flushed"]
186 for i in range(st["n_flushed"]):
187 self._chunk_path(i) # raises loudly if a chunk is missing
188 self.count, self.n_flushed = st["count"], st["n_flushed"]
189 self._new_chunk()
190 n = len(st["cur_prev"])
191 self.prev[:n], self.act[:n] = st["cur_prev"], st["cur_act"]
192 self.rew[:n], self.done[:n] = st["cur_rew"], st["cur_done"]
193 self.fill = n
194
195
196class Archive:

Callers 1

mainFunction · 0.95

Calls 2

_chunk_pathMethod · 0.95
_new_chunkMethod · 0.95

Tested by

no test coverage detected