Skip to content

Commit

Permalink
revert to work with the tensor states
Browse files Browse the repository at this point in the history
  • Loading branch information
deepbrain committed Oct 22, 2018
1 parent 1e2d7a4 commit 5a9f42a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def sample(self, batch_size):
segment = p_total / batch_size # Batch size number of segments, based on sum over all probabilities
batch = [self._get_sample_from_segment(segment, i) for i in range(batch_size)] # Get batch of valid samples
probs, idxs, tree_idxs, states, actions, returns, next_states, nonterminals = zip(*batch)
states, next_states, = np.stack(states), np.stack(next_states)
states, next_states, = torch.stack(states), torch.stack(next_states)
actions, returns, nonterminals = torch.cat(actions), torch.cat(returns), torch.stack(nonterminals)
probs = np.array(probs, dtype = np.float32)/p_total # Calculate normalised probabilities
capacity = self.capacity if self.transitions.full else self.transitions.index
Expand Down

0 comments on commit 5a9f42a

Please sign in to comment.