当前位置:网站首页>torch.utils.data.RandomSampler和torch.utils.data.SequentialSampler的区别
torch.utils.data.RandomSampler和torch.utils.data.SequentialSampler的区别
2022-06-27 09:35:00 【jjw_zyfx】
sampler_train = torch.utils.data.RandomSampler(torch.arange(10))
for i in sampler_train:
print(i)
print('=================')
for k in sampler_train:
print(k)
print('--------------')
sampler_val = torch.utils.data.SequentialSampler(torch.arange(10))
for j in sampler_val:
print(j)
print('=================')
for l in sampler_val:
print(l)
# 从结果上可以看出来RandomSampler随机采样在使用的时候,每次调用输出的
# 顺序都不大一样。而SequentialSampler顺序采样,每次结果都一样
输出结果:
3
0
1
6
4
5
9
7
8
2
=================
5
9
6
0
3
4
1
7
8
2
--------------
0
1
2
3
4
5
6
7
8
9
=================
0
1
2
3
4
5
6
7
8
9
边栏推荐
- Decompile the jar package and recompile it into a jar package after modification
- Advanced mathematics Chapter 7 differential equations
- js的数组拼接「建议收藏」
- 技术与业务同等重要,偏向任何一方都是错误
- Semi-supervised Learning入门学习——Π-Model、Temporal Ensembling、Mean Teacher简介
- Quartz(定时器)
- 如何获取GC(垃圾回收器)的STW(暂停)时间?
- 小白也能看懂的网络基础 03 | OSI 模型是如何工作的(经典强推)
- Vector:: data() pointer usage details
- Markem Imaje Marken IMAS printer maintenance 9450e printer maintenance
猜你喜欢

Enumeration? Constructor? Interview demo

最全H桥电机驱动模块L298N原理及应用

QT运行显示 This application failed to start because it could not find or load the Qt platform plugin

视频文件太大?使用FFmpeg来无损压缩它

Privacy computing fat offline prediction

Nosql 数据库 -Redis 安装

The largest rectangle in the bar graph of force buckle 84

小哥凭“量子速读”绝技吸粉59万:看街景图0.1秒,“啪的一下”在世界地图精准找到!...

有關二叉樹的一些練習題

E+H二次表维修PH变送器二次显示仪修理CPM253-MR0005
随机推荐
R语言使用econocharts包创建微观经济或宏观经济图、demand函数可视化需求曲线(demand curve)、自定义配置demand函数的参数丰富可视化效果
不容置疑,这是一个绝对精心制作的项目
Five page Jump methods for wechat applet learning
js 所有的网络请求方式
The background prompt module for accessing fastadmin after installation does not exist
Getting started with webrtc: 12 Rtendpoint and webrtcendpoint under kurento
有關二叉樹的一些練習題
多個類的設計
R语言plotly可视化:可视化多个数据集归一化直方图(historgram)并在直方图中添加密度曲线kde、设置不同的直方图使用不同的分箱大小(bin size)、在直方图的底部边缘添加边缘轴须图
TDengine 邀请函:做用技术改变世界的超级英雄,成为 TD Hero
The markdown plug-in of the browser cannot display the picture
微信小程序学习之五种页面跳转方法.
The most direct manifestation of memory leak
Rockermq message sending mode
ucore lab4
dns备用服务器信息,dns服务器地址(dns首选和备用填多少)
1098 Insertion or Heap Sort(堆排序解释)(PAT甲级)
MYSQL精通-01 增删改
js的数组拼接「建议收藏」
Video file too large? Use ffmpeg to compress it losslessly