From 89b074487fe2b9c274c53e135141003127103ba7 Mon Sep 17 00:00:00 2001 From: Kaiyuan Hu Date: Mon, 27 Feb 2023 19:38:53 +0800 Subject: [PATCH] Support specifying device via int Signed-off-by: Kaiyuan Hu --- isc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/isc.py b/isc.py index f9a3d2e..a187b6f 100644 --- a/isc.py +++ b/isc.py @@ -76,7 +76,7 @@ class Isc(NNOperator): super().__init__() if device is None: device = 'cuda' if torch.cuda.is_available() else 'cpu' - self.device = device + self.device = device if isinstance(device, str) else 'cpu' if device < 0 else torch.device(device) self.skip_tfms = skip_preprocess self.timm_backbone = timm_backbone