Skip to content

Commit 015002f

Browse files
committed
🏷️ Replace DeviceLikeType by explicit types
1 parent 7e650a8 commit 015002f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/torch_pca/pca_main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ def to(self, *args: Any, **kwargs: Any) -> None:
411411
kwargs : Any
412412
Keyword arguments to pass to the `.to()` method.
413413
They can be:
414-
device : torch.DeviceLikeType
414+
device : DeviceLikeType
415415
Device to move the model to.
416416
dtype : torch.dtype
417417
Data type to move the model to.
@@ -437,7 +437,7 @@ def to(self, *args: Any, **kwargs: Any) -> None:
437437
for arg in args:
438438
if isinstance(arg, torch.dtype):
439439
to_args["dtype"] = arg
440-
elif isinstance(arg, DeviceLikeType):
440+
elif isinstance(arg, (str, torch.device, int)):
441441
to_args["device"] = arg
442442
else:
443443
raise ValueError(

0 commit comments

Comments
 (0)