Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions torch/_functorch/partitioners.py
Original file line number Diff line number Diff line change
Expand Up @@ -1311,14 +1311,14 @@ def get_device(node) -> Optional[torch.device]:

for candidate in candidates:
if isinstance(candidate, torch.Tensor):
if candidate.device.type == "cuda":
if candidate.device.type in ["cuda", "xpu"]:
return candidate.device

return torch.device("cpu")

def get_sample_rng_state(device: Optional[torch.device]):
if device is not None and device.type == "cuda":
return torch.cuda.get_rng_state()
if device is not None and device.type in ["cuda", "xpu"]:
return torch.get_device_module().get_rng_state()
return torch.get_rng_state()

# Step 1 - Construct a mapping of rng node between the fwd and its counterpart in bwd.
Expand Down