mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
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:
committed by
PyTorch MergeBot
parent
428cbd7513
commit
2cbfcc740f
@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user