Skip to content

Commit 8da4d5b

Browse files
authored
Correct get_device Warnings (#698)
* Ensure warning only thrown if user requests difference divice than is given * Make requested changes
1 parent a893f51 commit 8da4d5b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

alibi_detect/utils/pytorch/misc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,6 @@ def get_device(device: Optional[Union[str, torch.device]] = None) -> torch.devic
8989
logger.warning('No GPU detected, fall back on CPU.')
9090
else:
9191
torch_device = torch.device('cpu')
92-
logger.warning('Requested device not recognised, fall back on CPU.')
92+
if device.lower() != 'cpu':
93+
logger.warning('Requested device not recognised, fall back on CPU.')
9394
return torch_device

0 commit comments

Comments
 (0)