chore: import upstream snapshot with attribution
Lint / lint (push) Has been cancelled
Build Docs / Deploy Docs (push) Has been cancelled
Windows CI / Windows (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:23:58 +08:00
commit 770d92cb1f
694 changed files with 114634 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
"""Utility functions for random number generation."""
import sys
def set_global_random_seed(seed):
"""Set global random seed for python, numpy, torch and tvm."""
if "numpy" in sys.modules:
sys.modules["numpy"].random.seed(seed)
if "torch" in sys.modules:
sys.modules["torch"].manual_seed(seed)
if "random" in sys.modules:
sys.modules["random"].seed(seed)
if "tvm" in sys.modules:
set_seed = sys.modules["tvm"].get_global_func("mlc.random.set_seed")
if set_seed:
set_seed(seed)