Skip to content

Commit

Permalink
reduced memory requirement for the rolling exp replay
Browse files Browse the repository at this point in the history
  • Loading branch information
VinF committed Oct 10, 2018
1 parent 8e5acc8 commit 88ab1c4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion deer/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,11 @@ def append(self, obj):
self._ub += 1

if self._ub > self._trueSize:
self._data[0:self._size-1] = self._data[self._lb:]
# Rolling array without copying whole array (for memory constraints)
# basic command: self._data[0:self._size-1] = self._data[self._lb:]
n_splits=10
for i in range(n_splits):
self._data[i*(self._size)//n_splits:(i+1)*(self._size)//n_splits] = self._data[self._lb+i*(self._size)//n_splits:self._lb+(i+1)*(self._size)//n_splits]
self._lb = 0
self._ub = self._size
self._cur = self._size - 1
Expand Down

0 comments on commit 88ab1c4

Please sign in to comment.