当前位置:网站首页>深度学习随机数设置,保证实验的可重复性
深度学习随机数设置,保证实验的可重复性
2022-07-31 07:13:00 【Mick..】
在深度学习实验的时候,由于代码里面存在大量的随机操作,因此导致实验的可重复性比较差。为了保证实验的可重复性,我们需要对实验中一些随机操作进行设置。
1 python 和 numpy
如果读取数据的过程采用了随机预处理(如RandomCrop、RandomHorizontalFlip等),那么对python、numpy的随机数生成器也需要设置种子。
import random
import numpy as np
random.seed(seed)
np.random.seed(seed)2 pytorch
torch.manual_seed(seed) # 为CPU设置随机种子
torch.cuda.manual_seed(seed) # 为当前GPU设置随机种子
torch.cuda.manual_seed_all(seed) # 为所有GPU设置随机种子
参考文献:
边栏推荐
- 最大似然估计和最小二乘法 含代码
- van-uploader uploads images, and cannot preview the image using base64 echo
- Fund investment advisory business
- 会话技术之Coookie && Session详解
- Pygame Surface对象
- CNN--Introduction to each layer
- 2022.07.15_每日一题
- Leetcode952. 按公因数计算最大组件大小
- Collation and sharing of related classic papers and datasets in the field of deep learning communication
- MySQL installation to the last step in the write the configuration file failed?And after the installation steps
猜你喜欢

MySql数据库优化查询工具

关于“算力”,这篇文章值得一看

NK-RTU980烧写裸机程序

我开发了一个利用 Bun 执行 .ts / .js 文件的 VS Code 插件

Client navicat installation tutorial

MySQL详解

Calculation example of matlab program iEEE9 node system for power flow calculation of AC-DC hybrid system based on alternate iteration method

MySQL 5.7详细下载安装配置教程

2022.07.20_每日一题

Linked list implementation and task scheduling
随机推荐
我开发了一个利用 Bun 执行 .ts / .js 文件的 VS Code 插件
2022.07.13_每日一题
链表实现及任务调度
Shell编程之条件语句
mysql插入新字段方法
Reimbursement Process | By Tianfang
Locust 1.0版本引入的变化
2022.07.15_Daily Question
基于交替迭代法的交直流混合系统潮流计算matlab程序iEEE9节点系统算例
页面懒加载
2022.07.18 _ a day
Linked list implementation and task scheduling
Tasks and task switching
'vite' is not an internal or external command, nor is it a runnable program or batch file.
"The C language games" mine clearance
2022.07.29_每日一题
安装部署KubeSphere管理kubernetes
Regarding "computing power", this article is worth reading
嵌入式系统驱动初级【2】——内核模块下_参数和依赖
Ceph single node deployment