lijn14
创建工程
c1a46f7
Raw
History Blame
507 Bytes
"""
随机种子管理模块 — 公共模块
"""
import random
import numpy as np
import torch
def set_seed(seed: int = 42):
"""
设置全局随机种子以确保实验可复现。
TODO [Person E]:
1. random.seed(seed)
2. np.random.seed(seed)
3. torch.manual_seed(seed)
4. torch.cuda.manual_seed_all(seed)
5. torch.backends.cudnn.deterministic = True
6. torch.backends.cudnn.benchmark = False
"""
raise NotImplementedError("TODO: Person E 实现 set_seed")