当前位置:网站首页>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
边栏推荐
- Today's three interviews demo[integer ASCII class relationship]
- 初步认识pytorch
- Freemarker
- Location and solution of network connection failure of primary online mobile terminal Report
- Obsidian 一周使用心得(配置、主题和插件)
- Vector:: data() pointer usage details
- 手把手带你玩摄像头模组
- Summary of three basic interview questions
- MySQL proficient-01 addition, deletion and modification
- Markem Imaje Marken IMAS printer maintenance 9450e printer maintenance
猜你喜欢

The largest rectangle in the bar graph of force buckle 84

IO pin configuration and pinctrl drive

Take you to play with the camera module

ucore lab3

HiTek电源维修X光机高压发生器维修XR150-603-02

A classic interview question covering 4 hot topics

Understand neural network structure and optimization methods

ucore lab3

Bluetooth health management device based on stm32

I'm almost addicted to it. I can't sleep! Let a bug fuck me twice!
随机推荐
一次线上移动端报表网络连接失败问题定位与解决
R语言使用econocharts包创建微观经济或宏观经济图、demand函数可视化需求曲线(demand curve)、自定义配置demand函数的参数丰富可视化效果
How do I get the STW (pause) time of a GC (garbage collector)?
分布式文件存储系统的优点和缺点
CLassLoader
手把手带你玩摄像头模组
Quartz(定时器)
Scientists develop two new methods to provide stronger security protection for intelligent devices
QT运行显示 This application failed to start because it could not find or load the Qt platform plugin
C# Any()和AII()方法
See how much volatile you know
[vivid understanding] the meanings of various evaluation indicators commonly used in deep learning TP, FP, TN, FN, IOU and accuracy
小哥凭“量子速读”绝技吸粉59万:看街景图0.1秒,“啪的一下”在世界地图精准找到!...
The background prompt module for accessing fastadmin after installation does not exist
ucore lab3
【STM32】HAL库 STM32CubeMX教程十二—IIC(读取AT24C02 )
I'm almost addicted to it. I can't sleep! Let a bug fuck me twice!
了解神经网络结构和优化方法
win10为任意文件添加右键菜单
js中的数组对象