MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / LazyFrames

Class LazyFrames

rl3/a2c/atari_wrappers.py:201–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199
200
201class LazyFrames:
202 def __init__(self, frames):
203 """This object ensures that common frames between the observations are only stored once.
204 It exists purely to optimize memory usage which can be huge for DQN's 1M frames replay
205 buffers.
206
207 This object should only be converted to numpy array before being passed to the model.
208
209 You'd not believe how complex the previous solution was."""
210 self._frames = frames
211
212 def __array__(self, dtype=None):
213 out = np.concatenate(self._frames, axis=2)
214 if dtype is not None:
215 out = out.astype(dtype)
216 return out
217
218
219def make_atari(env_id):

Callers 1

_get_obMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected