当前位置:网站首页>PyTorch模型训练:设置随机种子,保证每次训练的结果都一样
PyTorch模型训练:设置随机种子,保证每次训练的结果都一样
2022-07-22 01:03:00 【u013250861】
模型训练:设置随机种子,保证每次训练的结果都一样
def seed_everything(seed=1029):
''' 设置整个开发环境的seed :param seed: :param device: :return: '''
random.seed(seed)
os.environ['PYTHONHASHSEED'] = str(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
# some cudnn methods can be random even after fixing the seed unless you tell it to be deterministic
torch.backends.cudnn.deterministic = True
边栏推荐
- Parker hydraulic oil pump pvp3336r2m
- MySql集群之一主多从架构(三)
- Cache and redirection in HTTP practice
- Using Siemens low code to realize the agility of enterprise quality management process
- MySql集群之集群配置与验证(四)
- 堆(优先级队列)
- Typescript array extension use
- With an annual salary of 30W, the growth path of software testers, at which stage are you?
- 5. ZABBIX create a custom key
- Tas (file d'attente prioritaire)
猜你喜欢
随机推荐
Rexroth Rexroth plunger pump a15vso
Microwave radar human body sensor, instant presence sensing scheme, smart home human body sensing interaction
英国天气过热导致谷歌云、Oracle云服务中断
The difference between using @fastnative and @criticalnative
年薪30W,软件测试人的成长之路,你在哪个阶段?
【Cicadaplayer】Release无法断点调试的问题
Ardunio開發——水泵操作過程
表格的隔行变色
Classification de l'index MySQL et exemples d'utilisation
派克液压油泵PVP3336R2M
rexroth力士乐柱塞泵A15VSO
MySQL index classification and its application examples
With an annual salary of 30W, the growth path of software testers, at which stage are you?
The difference and connection between cookies and seesion
Swoole-TCP服务器
From 20s to 500ms, I used these three methods
Chapter 3 processing data
【云原生之kubernetes】在kubernetes集群下的jobs与cronjobs管理
[development of large e-commerce projects] thread pool - completable future -48
Grpc MagicOnion库 之 客户端和服务端 (案例版)