patch_torch_manual_seed() — pytorch Function Reference
Architecture documentation for the patch_torch_manual_seed() function in common.py from the pytorch codebase.
Entity Profile
Dependency Diagram
graph TD 41369485_8a81_562f_2f09_b8d03a5222f0["patch_torch_manual_seed()"] 9c8df7bf_0e05_9bbb_5e2f_6c88f28b52d4["timed()"] 9c8df7bf_0e05_9bbb_5e2f_6c88f28b52d4 -->|calls| 41369485_8a81_562f_2f09_b8d03a5222f0 c9be2096_e6d7_2374_ad2e_a6e33f435ada["run()"] c9be2096_e6d7_2374_ad2e_a6e33f435ada -->|calls| 41369485_8a81_562f_2f09_b8d03a5222f0 style 41369485_8a81_562f_2f09_b8d03a5222f0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
benchmarks/dynamo/common.py lines 540–559
def patch_torch_manual_seed():
"""Make torch manual seed deterministic. Helps with accuracy testing."""
def deterministic_torch_manual_seed(*args, **kwargs):
from torch._C import default_generator
seed = 1337
if HAS_CUDA:
import torch.cuda
if not torch.cuda._is_in_bad_fork():
torch.cuda.manual_seed_all(seed)
if HAS_XPU:
import torch.xpu
if not torch.xpu._is_in_bad_fork():
torch.xpu.manual_seed_all(seed)
return default_generator.manual_seed(seed)
torch.manual_seed = deterministic_torch_manual_seed
Domain
Subdomains
Source
Frequently Asked Questions
What does patch_torch_manual_seed() do?
patch_torch_manual_seed() is a function in the pytorch codebase.
What calls patch_torch_manual_seed()?
patch_torch_manual_seed() is called by 2 function(s): run, timed.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free