mirror of
https://github.com/wassname/DeepRL.git
synced 2026-10-28 12:30:38 +08:00
Fix a bug for GPU
This commit is contained in:
1 parent
6f517e3eef
commit
4f2903eb8f
1 file changed
+1
-1
@@ -12,7 +12,7 @@ import numpy as np
|
||||
class BaseNet:
|
||||
def set_gpu(self, gpu):
|
||||
if gpu >= 0 and torch.cuda.is_available():
|
||||
self.device = torch.device('gpu:%d' % (gpu))
|
||||
self.device = torch.device('cuda:%d' % (gpu))
|
||||
else:
|
||||
self.device = torch.device('cpu')
|
||||
self.to(self.device)
|
||||
|
||||
Reference in new issue
Block a user