2051aa89ec691d1c056e3e1f1187c489597c2ead,slm_lab/agent/memory/replay.py,Replay,reset,#Replay#,58
Before Change
"""Initializes the memory arrays, size and head pointer"""
states_shape = np.concatenate([[self.max_size], np.reshape(self.body.state_dim, -1)])
self.data_keys = ["states", "actions", "rewards", "next_states", "dones", "priorities"]
setattr(self, "states", np.zeros(states_shape))
// TODO generalize for multi-action
setattr(self, "actions", np.zeros((self.max_size,), dtype=self.body.action_space.dtype))
setattr(self, "rewards", np.zeros((self.max_size,)))
setattr(self, "next_states", np.zeros(states_shape))
setattr(self, "dones", np.zeros((self.max_size,), dtype=np.uint8))
setattr(self, "priorities", np.zeros((self.max_size,)))
self.true_size = 0
self.head = -1 // Index of most recent experience
After Change
elif k == "actions":
setattr(self, k, np.zeros(self.actions_shape, dtype=self.body.action_space.dtype))
else:
setattr(self, k, np.zeros(self.scalar_shape))
self.true_size = 0
self.head = -1
self.state_buffer.clear()
for _ in range(self.state_buffer.maxlen):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: kengz/SLM-Lab
Commit Name: 2051aa89ec691d1c056e3e1f1187c489597c2ead
Time: 2018-08-17
Author: kengzwl@gmail.com
File Name: slm_lab/agent/memory/replay.py
Class Name: Replay
Method Name: reset
Project Name: rail-berkeley/softlearning
Commit Name: 1113670b794b23c39cf23a9a532f866d08b63fdb
Time: 2018-06-30
Author: kristian.hartikainen@gmail.com
File Name: softlearning/replay_buffers/simple_replay_buffer.py
Class Name: SimpleReplayBuffer
Method Name: __init__
Project Name: kengz/SLM-Lab
Commit Name: 2051aa89ec691d1c056e3e1f1187c489597c2ead
Time: 2018-08-17
Author: kengzwl@gmail.com
File Name: slm_lab/agent/memory/replay.py
Class Name: Replay
Method Name: reset
Project Name: kengz/SLM-Lab
Commit Name: 87c0c7b44ae24c55b7df009656fd497052d0ea44
Time: 2019-04-30
Author: kengzwl@gmail.com
File Name: slm_lab/agent/memory/replay.py
Class Name: Replay
Method Name: reset