iffiX / machin

Reinforcement learning library(framework) designed for PyTorch, implements DQN, DDPG, A2C, PPO, SAC, MADDPG, A3C, APEX, IMPALA ...
MIT License
400 stars 51 forks source link

Algorithm impala cannot use GPU[ALTER] #2

Closed HouSo1in closed 4 years ago

HouSo1in commented 4 years ago

machin/frame/algorithms/impala.py, line 363, 373

vs[idx] = (value[idx] + delta_v[idx] + self.discount * c[idx] * (vs[idx + 1] - value[idx + 1]))

This should be corrected to the following code

vs[idx] = (value[idx].to('cpu') + delta_v[idx] + self.discount * c[idx] * (vs[idx + 1] - value[idx + 1].to('cpu')))

Do the same for line 373

iffiX commented 4 years ago

Fixing the problem, currently I am restructuring my test suite to support GPU testing.

iffiX commented 4 years ago

OK, problem should have been fixed, now merge to release branch and push as a new version: https://github.com/iffiX/machin/commit/5fca74e733962c28e3190b60f8b79fbbe18a0aaf