mirror of
https://github.com/wassname/DeepRL.git
synced 2026-09-09 11:13:47 +08:00
Fix a bug for GPU
This commit is contained in:
@@ -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