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.
1 parent 3fa7eb2 commit 1664834Copy full SHA for 1664834
torch_xla/torch_xla.py
@@ -36,14 +36,15 @@ def device(index: int = None) -> torch.device:
36
torch_xla._XLAC._xla_set_default_device(device)
37
return torch.device(device)
38
39
- if n is None:
+ if index is None:
40
return torch.device(torch_xla._XLAC._xla_get_default_device())
41
42
devices = xm.get_xla_supported_devices()
43
- if n > len(devices):
44
- raise IndexError('Device index {} out of range in {}'.format(n, devices))
+ if index > len(devices):
+ raise IndexError('Device index {} out of range in {}'.format(
45
+ index, devices))
46
- device = devices[n]
47
+ device = devices[index]
48
49
50
0 commit comments