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.
2 parents b683b6e + 07e16fd commit 808e603Copy full SHA for 808e603
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