8000 Revert ExplicitDevice changes · pytorch/pytorch@daac118 · GitHub
[go: up one dir, main page]

Skip to content

Commit daac118

Browse files
committed
Revert ExplicitDevice changes
1 parent f93f2a1 commit daac118

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

torch/accelerator/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from typing_extensions import deprecated
77

88
import torch
9-
from torch.types import ExplicitDevice
109

1110
from ._utils import _device_t, _get_device_index
1211

@@ -121,7 +120,7 @@ def current_device_index() -> int:
121120
)(current_device_index)
122121

123122

124-
def set_device_index(device: ExplicitDevice, /) -> None:
123+
def set_device_index(device: _device_t, /) -> None:
125124
r"""Set the current device index to a given device.
126125
127126
Args:

torch/types.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@
7070

7171
# Meta-type for "device-like" things. Not to be confused with 'device' (a
7272
# literal device object). This nomenclature is consistent with PythonArgParser.
73-
ExplicitDevice: TypeAlias = Union[_device, str, int]
7473
# None means use the default device (typically CPU)
75-
Device: TypeAlias = Union[ExplicitDevice, None]
74+
Device: TypeAlias = Union[_device, str, int, None]
7675

7776

7877
# Storage protocol implemented by ${Type}StorageBase classes

0 commit comments

Comments
 (0)
0