Skip to content

Commit

Permalink
fix PER CUDA device assignment (#171)
Browse files Browse the repository at this point in the history
* fix PER CUDA device assignment

* fix reference

* efficient dynamic device setting

* set tensor device

* mvoe to cpu instead for efficiency
  • Loading branch information
kengz authored Sep 15, 2018
1 parent 66788f9 commit bdb4942
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion slm_lab/agent/memory/prioritized.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def add_experience(self, state, action, reward, next_state, done, error=100000):

def get_priority(self, error):
'''Takes in the error of one or more examples and returns the proportional priority'''
p = torch.pow(error + self.epsilon, self.alpha)
p = torch.pow(error.cpu() + self.epsilon, self.alpha)
return p.squeeze_().cpu().numpy()

def sample_idxs(self, batch_size):
Expand Down
1 change: 1 addition & 0 deletions slm_lab/experiment/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class Body:

def __init__(self, env, agent_spec, aeb=(0, 0, 0), aeb_space=None):
# essential reference variables
self.agent = None # set later
self.env = env
self.aeb = aeb
self.a, self.e, self.b = aeb
Expand Down

0 comments on commit bdb4942

Please sign in to comment.