We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4a0a918 commit 07e16fdCopy full SHA for 07e16fd
py/trtorch/Device.py
@@ -107,7 +107,11 @@ def _from_torch_device(cls, torch_dev: torch.device):
107
108
@classmethod
109
def _current_device(cls):
110
- dev = trtorch._C._get_current_device()
+ try:
111
+ dev = trtorch._C._get_current_device()
112
+ except RuntimeError:
113
+ trtorch.logging.log(trtorch.logging.Level.Error, "Cannot get current device")
114
+ return None
115
return cls(gpu_id=dev.gpu_id)
116
117
@staticmethod
0 commit comments