replace with torch.cuda.device with with torch.accelerator.device_index (#36144)

Signed-off-by: Yan Ma <yan.ma@intel.com>
This commit is contained in:
Yan Ma
2026-03-11 23:12:57 -07:00
committed by GitHub
parent 584a3f56de
commit 894843eb25
10 changed files with 17 additions and 15 deletions
+1 -1
View File
@@ -105,7 +105,7 @@ def input_guard(fn: Callable[..., torch.Tensor]) -> Callable[..., torch.Tensor]:
break
if tensor is not None:
ctx = torch.cuda.device(tensor.device.index)
ctx = torch.accelerator.device_index(tensor.device.index)
else:
ctx = contextlib.nullcontext()