mirror of
https://github.com/wassname/DeepRL.git
synced 2026-09-09 11:13:47 +08:00
Minor update
This commit is contained in:
@@ -12,6 +12,7 @@ import numpy as np
|
||||
class BaseNet:
|
||||
def set_gpu(self, gpu):
|
||||
if gpu >= 0 and torch.cuda.is_available():
|
||||
gpu = gpu % torch.cuda.device_count()
|
||||
self.device = torch.device('cuda:%d' % (gpu))
|
||||
else:
|
||||
self.device = torch.device('cpu')
|
||||
|
||||
Reference in New Issue
Block a user