d1fe177a4f3057e9e8b71ab820dbe5fe2a538276,ch07/04_dqn_noisy_net.py,,unpack_batch,#Any#,37
Before Change
def unpack_batch(batch):
states = [exp[0].state for exp in batch]
next_states = [exp[-1].state for exp in batch]
actions = [exp[0].action for exp in batch]
rewards = [exp[0].reward for exp in batch]
dones = [exp[0].done for exp in batch]
return np.array(states, copy=False), np.array(actions), np.array(rewards, dtype=np.float32), \
np.array(dones, dtype=np.uint8), np.array(next_states, copy=False)
After Change
def unpack_batch(batch):
states, actions, rewards, dones, last_states = [], [], [], [], []
for exp in batch:
state = np.array(exp.state, copy=False)
states.append(state)
actions.append(exp.action)
rewards.append(exp.reward)
dones.append(exp.last_state is None)
if exp.last_state is None:
last_states.append(state) // the result will be masked anyway
else:
last_states.append(np.array(exp.last_state, copy=False))
return np.array(states, copy=False), np.array(actions), np.array(rewards, dtype=np.float32), \
np.array(dones, dtype=np.uint8), np.array(last_states, copy=False)
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 58
Instances
Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: d1fe177a4f3057e9e8b71ab820dbe5fe2a538276
Time: 2017-10-31
Author: max.lapan@gmail.com
File Name: ch07/04_dqn_noisy_net.py
Class Name:
Method Name: unpack_batch
Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: d1fe177a4f3057e9e8b71ab820dbe5fe2a538276
Time: 2017-10-31
Author: max.lapan@gmail.com
File Name: ch07/04_dqn_noisy_net.py
Class Name:
Method Name: unpack_batch
Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: 19bd1246a9fd868b9f2a7c7baa53153976e588f9
Time: 2017-10-31
Author: max.lapan@gmail.com
File Name: ch07/03_dqn_double.py
Class Name:
Method Name: unpack_batch
Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: d1fe177a4f3057e9e8b71ab820dbe5fe2a538276
Time: 2017-10-31
Author: max.lapan@gmail.com
File Name: ch07/06_dqn_dueling.py
Class Name:
Method Name: unpack_batch
Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: 7652be1bb976484c552af3e710397b4eb104379d
Time: 2017-10-31
Author: max.lapan@gmail.com
File Name: ch07/03_dqn_double.py
Class Name:
Method Name: unpack_batch