use torch.xpu.manual_seed_all in torch.seed (#110376)

# Motivate
Use manual_seed_all instead of manual_seed. Because multi-device is supported in xpu backend.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/110376
Approved by: https://github.com/ezyang
This commit is contained in:
Yu, Guangye
2023-10-03 13:41:55 +00:00
committed by PyTorch MergeBot
parent 428cbd7513
commit 2cbfcc740f

View File

@ -44,7 +44,7 @@ def manual_seed(seed) -> torch._C.Generator:
torch.mps.manual_seed(seed)
if hasattr(torch, 'xpu') and not torch.xpu._is_in_bad_fork():
torch.xpu.manual_seed(seed)
torch.xpu.manual_seed_all(seed)
_seed_custom_device(seed)
@ -66,7 +66,7 @@ def seed() -> int:
torch.mps.manual_seed(seed)
if hasattr(torch, 'xpu') and not torch.xpu._is_in_bad_fork():
torch.xpu.manual_seed(seed)
torch.xpu.manual_seed_all(seed)
_seed_custom_device(seed)