PyTorch torch.utils.data.Dataset怎么使用


本篇内容主要讲解“PyTorchtorch.utils.data.Dataset怎么使用”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“PyTorchtorch.utils.data.Dataset怎么使用”吧!在 PyTorch 中,提供了一个处理数据集的工具torch.utils.data。这里来简单介绍这个包是什么。训练模型一般都是先处理 数据的输入问题预处理问题 。Pytorch提供了几个有用的工具:torch.utils.data.Dataset 类和 torch.utils.data.DataLoader 类 。流程是先把原始数据转变成 torch.utils.data.Dataset 类,随后再把得到的 torch.utils.data.Dataset 类当作一个参数传递给 torch.utils.data.DataLoader 类,得到一个数据加载器,这个数据加载器每次可以返回一个 Batch 的数据供模型训练使用。在 pytorch 中,提供了一种十分方便的数据读取机制,即使用 torch.utils.data.DatasetDataloader 组合得到数据迭代器。在每次训练时,利用这个迭代器输出每一个 batch 数据,并能在输出时对数据进行相应的预处理或数据增广操作。本文我们主要介绍对 torch.utils.data.Dataset 的理解,对 Dataloader 的介绍请参考我的另一篇文章:【PyTorch】torch.utils.data.DataLoader 简单介绍与使用在本文的最后将给出 torch.utils.data.DatasetDataloader 结合使用处理数据的实战代码。pytorch 提供了一个数据读取的方法,其由两个类构成:torch.utils.data.Dataset 和 DataLoader。如果我们要自定义自己读取数据的方法,就需要继承类 torch.utils.data.Dataset ,并将其封装到DataLoader 中。torch.utils.data.Dataset 是一个 类 Dataset 。通过重写定义在该类上的方法,我们可以实现多种数据读取及数据预处理方式。torch.utils.data.Dataset 的源码:注释翻译:表示一个数据集的抽象类。所有其他数据集都应该对其进行子类化。 所有子类都应该重写提供数据集大小的 __len____getitem__ ,支持从 0 到 len(self) 独占的整数索引。理解:就是说,Dataset 是一个 数据集 抽象类,它是其他所有数据集类的父类(所有其他数据集类都应该继承它),继承时需要重写方法 __len____getitem____len__ 是提供数据集大小的方法, __getitem__ 是可以通过索引号找到数据的方法。torch.utils.data.Dataset 是代表自定义数据集的抽象类,我们可以定义自己的数据类抽象这个类,只需要重写__len__和__getitem__这两个方法就可以。要自定义自己的 Dataset 类,至少要重载两个方法:__len__, __getitem____len__返回的是数据集的大小__getitem__实现索引数据集中的某一个数据下面将简单实现一个返回 torch.Tensor 类型的数据集:输出结果:tensor([[ 0.8618, 0.4644, -0.5929],
[ 0.9566, -0.9067, 1.5781],
[ 0.3943, -0.7775, 2.0366],
[-1.2570, -0.3859, -0.3542]])
tensor([0.1363, 0.6545, 0.4345, 0.9928])
tensor_data[0]: (tensor([ 0.8618, 0.4644, -0.5929]), tensor(0.1363))
len os tensor_dataset: 4因为我们可以通过定义自己的数据集类并重写该类上的方法 实现多种多样的(自定义的)数据读取方式。比如,我们重写 __init__ 实现用 pd.read_csv 读取 csv 文件:输出结果:[0.000e+00 0.000e+00 0.000e+00 0.000e+00 6.300e-01 0.000e+00 3.100e-01
6.300e-01 3.100e-01 6.300e-01 3.100e-01 3.100e-01 3.100e-01 0.000e+00
0.000e+00 3.100e-01 0.000e+00 0.000e+00 3.180e+00 0.000e+00 3.100e-01
0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
1.370e-01 0.000e+00 1.370e-01 0.000e+00 0.000e+00 3.537e+00 4.000e+01
1.910e+02 1.000e+00]
4601要点:自己定义的 dataset 类需要继承 Dataset。需要实现必要的魔法方法:在 __init__ 方法里面进行 读取数据文件
__getitem__ 方法里支持通过下标访问数据。
__len__ 方法里返回自定义数据集的大小,方便后期遍历。数据集 spambase.csv 用的是 UCI 机器学习存储库里的垃圾邮件数据集,它一条数据有57个特征和1个标签。输出结果:steop:0, batch_x:tensor([[0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 6.3000e-01, 0.0000e+00,
3.1000e-01, 6.3000e-01, 3.1000e-01, 6.3000e-01, 3.1000e-01, 3.1000e-01,
3.1000e-01, 0.0000e+00, 0.0000e+00, 3.1000e-01, 0.0000e+00, 0.0000e+00,
3.1800e+00, 0.0000e+00, 3.1000e-01, 0.0000e+00, 0.0000e+00, 0.0000e+00,
0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
0.0000e+00, 1.3500e-01, 0.0000e+00, 1.3500e-01, 0.0000e+00, 0.0000e+00,
3.5370e+00, 4.0000e+01, 1.9100e+02],
[0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 6.3000e-01, 0.0000e+00,
3.1000e-01, 6.3000e-01, 3.1000e-01, 6.3000e-01, 3.1000e-01, 3.1000e-01,
3.1000e-01, 0.0000e+00, 0.0000e+00, 3.1000e-01, 0.0000e+00, 0.0000e+00,
3.1800e+00, 0.0000e+00, 3.1000e-01, 0.0000e+00, 0.0000e+00, 0.0000e+00,
0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
0.0000e+00, 1.3700e-01, 0.0000e+00, 1.3700e-01, 0.0000e+00, 0.0000e+00,
3.5370e+00, 4.0000e+01, 1.9100e+02]], dtype=torch.float64), batch_y:tensor([1, 1])
steop:1, batch_x:tensor([[2.1000e-01, 2.8000e-01, 5.0000e-01, 0.0000e+00, 1.4000e-01, 2.8000e-01,
2.1000e-01, 7.0000e-02, 0.0000e+00, 9.4000e-01, 2.1000e-01, 7.9000e-01,
6.5000e-01, 2.1000e-01, 1.4000e-01, 1.4000e-01, 7.0000e-02, 2.8000e-01,
3.4700e+00, 0.0000e+00, 1.5900e+00, 0.0000e+00, 4.3000e-01, 4.3000e-01,
0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
7.0000e-02, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
0.0000e+00, 1.3200e-01, 0.0000e+00, 3.7200e-01, 1.8000e-01, 4.8000e-02,
5.1140e+00, 1.0100e+02, 1.0280e+03],
[6.0000e-02, 0.0000e+00, 7.1000e-01, 0.0000e+00, 1.2300e+00, 1.9000e-01,
1.9000e-01, 1.2000e-01, 6.4000e-01, 2.5000e-01, 3.8000e-01, 4.5000e-01,
1.2000e-01, 0.0000e+00, 1.7500e+00, 6.0000e-02, 6.0000e-02, 1.0300e+00,
1.3600e+00, 3.2000e-01, 5.1000e-01, 0.0000e+00, 1.1600e+00, 6.0000e-02,
0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
0.0000e+00, 0.0000e+00, 0.0000e+00, 6.0000e-02, 0.0000e+00, 0.0000e+00,
1.2000e-01, 0.0000e+00, 6.0000e-02, 6.0000e-02, 0.0000e+00, 0.0000e+00,
1.0000e-02, 1.4300e-01, 0.0000e+00, 2.7600e-01, 1.8400e-01, 1.0000e-02,
9.8210e+00, 4.8500e+02, 2.2590e+03]], dtype=torch.float64), batch_y:tensor([1, 1])
steop:2, batch_x:tensor([[ 0.0000, 0.6400, 0.6400, 0.0000, 0.3200, 0.0000, 0.0000,
0.0000, 0.0000, 0.0000, 0.0000, 0.6400, 0.0000, 0.0000,
0.0000, 0.3200, 0.0000, 1.2900, 1.9300, 0.0000, 0.9600,
0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
0.0000, 0.0000, 0.7780, 0.0000, 0.0000, 3.7560, 61.0000,
278.0000]], dtype=torch.float64), batch_y:tensor([1])一共 5 条数据,batch_size 设为 2 ,则数据被分为三组,每组的数据量为:2,2,1。输出结果:4601
steop:0, batch_x:tensor([[0.0000e+00, 2.4600e+00, 0.0000e+00, …, 2.1420e+00, 1.0000e+01,
7.5000e+01],
[0.0000e+00, 0.0000e+00, 1.6000e+00, …, 2.0650e+00, 1.2000e+01,
9.5000e+01],
[0.0000e+00, 0.0000e+00, 3.6000e-01, …, 3.7220e+00, 2.0000e+01,
2.6800e+02],
…,
[7.7000e-01, 3.8000e-01, 7.7000e-01, …, 1.4619e+01, 5.2500e+02,
9.2100e+02],
[0.0000e+00, 0.0000e+00, 0.0000e+00, …, 1.0000e+00, 1.0000e+00,
5.0000e+00],
[4.0000e-01, 1.8000e-01, 3.2000e-01, …, 3.3050e+00, 1.8100e+02,
1.6130e+03]], dtype=torch.float64), batch_y:tensor([0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1,
0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0,
0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0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 0, 1,
1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1,
0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1,
0, 1, 0, 1])
steop:1, batch_x:tensor([[0.0000e+00, 0.0000e+00, 0.0000e+00, …, 1.0000e+00, 1.0000e+00,
2.0000e+00],
[4.9000e-01, 0.0000e+00, 7.4000e-01, …, 3.9750e+00, 4.7000e+01,
4.8500e+02],
[0.0000e+00, 0.0000e+00, 7.1000e-01, …, 4.0220e+00, 9.7000e+01,
5.4300e+02],
…,
[0.0000e+00, 1.4000e-01, 1.4000e-01, …, 5.3310e+00, 8.0000e+01,
1.0290e+03],
[0.0000e+00, 0.0000e+00, 3.6000e-01, …, 3.1760e+00, 5.1000e+01,
2.7000e+02],
[0.0000e+00, 0.0000e+00, 0.0000e+00, …, 1.1660e+00, 2.0000e+00,
7.0000e+00]], dtype=torch.float64), batch_y:tensor([0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0,
0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0,
1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0,
1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0,
0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0,
1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 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
[0.0000e+00, 0.0000e+00, 0.0000e+00, …, 2.0450e+00, 6.0000e+00,
4.5000e+01],
…,
[4.0000e-01, 0.0000e+00, 0.0000e+00, …, 1.1940e+00, 5.0000e+00,
1.2900e+02],
[2.6000e-01, 0.0000e+00, 0.0000e+00, …, 1.8370e+00, 1.1000e+01,
1.5800e+02],
[5.0000e-02, 0.0000e+00, 1.0000e-01, …, 3.7150e+00, 1.0700e+02,
1.3860e+03]], dtype=torch.float64), batch_y:tensor([1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0,
1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0,
0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0,
0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0,
0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0,
0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0,
0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1,
0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0,
1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0,
0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0,
0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0,
1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,
1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1,
1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0,
1, 1, 0, 0])
steop:3, batch_x:tensor([[2.6000e-01, 0.0000e+00, 5.3000e-01, …, 2.6460e+00, 7.7000e+01,
1.7200e+02],
[0.0000e+00, 0.0000e+00, 0.0000e+00, …, 2.4280e+00, 5.0000e+00,
1.7000e+01],
[3.4000e-01, 0.0000e+00, 1.7000e+00, …, 6.6700e+02, 1.3330e+03,
1.3340e+03],
…,
[0.0000e+00, 0.0000e+00, 0.0000e+00, …, 1.0000e+00, 1.0000e+00,
7.0000e+00],
[0.0000e+00, 0.0000e+00, 0.0000e+00, …, 2.7010e+00, 2.0000e+01,
1.8100e+02],
[0.0000e+00, 0.0000e+00, 0.0000e+00, …, 4.0000e+00, 1.1000e+01,
3.6000e+01]], dtype=torch.float64), batch_y:tensor([0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 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, 0, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1,
1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0,
1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0,
1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0,
1, 0, 0, 1])
steop:4, batch_x:tensor([[ 0.0000, 0.0000, 0.3100, …, 5.7080, 138.0000, 274.0000],
[ 0.0000, 0.0000, 0.3400, …, 2.2570, 17.0000, 158.0000],
[ 1.0400, 0.0000, 0.0000, …, 1.0000, 1.0000, 17.0000],
…,
[ 0.0000, 0.0000, 0.0000, …, 4.0000, 12.0000, 28.0000],
[ 0.3300, 0.0000, 0.0000, …, 1.7880, 6.0000, 93.0000],
[ 0.0000, 14.2800, 0.0000, …, 1.8000, 5.0000, 9.0000]],
dtype=torch.float64), batch_y:tensor([1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1,
0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1,
0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0,
1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1,
0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0,
1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0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02],
[0.0000e+00, 3.3600e+00, 1.9200e+00, …, 6.1370e+00, 1.0700e+02,
1.7800e+02],
[5.4000e-01, 0.0000e+00, 1.0800e+00, …, 5.4540e+00, 6.8000e+01,
1.8000e+02],
…,
[0.0000e+00, 0.0000e+00, 0.0000e+00, …, 3.8330e+00, 9.0000e+00,
2.3000e+01],
[6.0000e-02, 6.5000e-01, 7.1000e-01, …, 4.7420e+00, 1.1700e+02,
1.3420e+03],
[0.0000e+00, 0.0000e+00, 0.0000e+00, …, 2.6110e+00, 1.2000e+01,
4.7000e+01]], dtype=torch.float64), batch_y:tensor([1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1,
1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0,
0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1,
0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1,
0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0,
0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1,
1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1,
0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1,
1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1,
0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0,
0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1,
0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0,
1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0,
0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 1, 1, 1])
steop:6, batch_x:tensor([[0.0000e+00, 1.4280e+01, 0.0000e+00, …, 1.8000e+00, 5.0000e+00,
9.0000e+00],
[0.0000e+00, 0.0000e+00, 0.0000e+00, …, 1.9280e+00, 1.5000e+01,
5.4000e+01],
[0.0000e+00, 0.0000e+00, 0.0000e+00, …, 1.0692e+01, 6.5000e+01,
1.3900e+02],
…,
[0.0000e+00, 0.0000e+00, 0.0000e+00, …, 1.5000e+00, 5.0000e+00,
2.4000e+01],
[7.6000e-01, 1.9000e-01, 3.8000e-01, …, 3.7020e+00, 4.5000e+01,
1.0700e+03],
[0.0000e+00, 0.0000e+00, 0.0000e+00, …, 2.0000e+00, 1.2000e+01,
8.8免费云主机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, 0, 0, 1,
0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1,
0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0,
0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1,
1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1,
1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1,
1, 0, 1, 0])
steop:7, batch_x:tensor([[0.0000e+00, 2.7000e-01, 0.0000e+00, …, 5.8020e+00, 4.3000e+01,
4.1200e+02],
[0.0000e+00, 3.5000e-01, 7.0000e-01, …, 3.6390e+00, 6.1000e+01,
3.1300e+02],
[0.0000e+00, 0.0000e+00, 0.0000e+00, …, 1.5920e+00, 7.0000e+00,
1.2900e+02],
…,
[8.0000e-02, 1.6000e-01, 8.0000e-02, …, 2.7470e+00, 8.6000e+01,
1.9950e+03],
[0.0000e+00, 0.0000e+00, 0.0000e+00, …, 1.6130e+00, 1.1000e+01,
7.1000e+01],
[0.0000e+00, 0.0000e+00, 0.0000e+00, …, 1.9110e+00, 1.5000e+01,
6.5000e+01]], dtype=torch.float64), batch_y:tensor([0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0,
0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0,
1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1,
0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0,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1, 0, 1,
0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1,
1, 0, 0, 0])
steop:8, batch_x:tensor([[1.7000e-01, 0.0000e+00, 1.7000e-01, …, 1.7960e+00, 1.2000e+01,
4.5800e+02],
[3.7000e-01, 0.0000e+00, 6.3000e-01, …, 1.1810e+00, 4.0000e+00,
1.0400e+02],
[0.0000e+00, 0.0000e+00, 0.0000e+00, …, 1.0000e+00, 1.0000e+00,
7.0000e+00],
…,
[2.3000e-01, 0.0000e+00, 4.7000e-01, …, 2.4200e+00, 1.2000e+01,
3.3400e+02],
[0.0000e+00, 0.0000e+00, 1.2900e+00, …, 1.3500e+00, 4.0000e+00,
2.7000e+01],
[0.0000e+00, 0.0000e+00, 0.0000e+00, …, 1.3730e+00, 1.1000e+01,
1.6900e+02]], dtype=torch.float64), batch_y:tensor([1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1,
0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0,
1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0,
0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1,
1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0,
0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0,
0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0,
0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1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1, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1,
1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0,
0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0,
1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0,
1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0,
1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0,
1, 1, 1, 1])
steop:10, batch_x:tensor([[0.0000e+00, 2.5000e-01, 7.5000e-01, 0.0000e+00, 1.0000e+00, 2.5000e-01,
0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 2.5000e-01, 2.5000e-01,
1.2500e+00, 0.0000e+00, 0.0000e+00, 2.5000e-01, 0.0000e+00, 1.2500e+00,
2.5100e+00, 0.0000e+00, 1.7500e+00, 0.0000e+00, 2.5000e-01, 0.0000e+00,
0.0000e+00, 0.0000e+00, 2.5000e-01, 0.0000e+00, 0.0000e+00, 0.0000e+00,
0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
0.0000e+00, 0.0000e+00, 0.0000e+00, 4.2000e-02, 0.0000e+00, 0.0000e+00,
1.2040e+00, 7.0000e+00, 1.1800e+02]], dtype=torch.float64), batch_y:tensor([0])一共 4601 条数据,按 batch_size = 460 来分:能划分为 11 组,前 10 组的数据量为 460,最后一组的数据量为 1 。到此,相信大家对“PyTorchtorch.utils.data.Dataset怎么使用”有了更深的了解,不妨来实际操作一番吧!这里是百云主机网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

相关推荐: Go语言中如何利用HTTP包创建WEB服务器

今天小编给大家分享一下Go语言中如何利用HTTP包创建WEB服务器的相关知识点,内容详细,逻辑清晰,相信大部分人都还太了解这方面的知识,所以分享这篇文章给大家参考一下,希望大家阅读完这篇文章后有所收获,下面我们一起来了解一下吧。在Golang中写一个http …

免责声明:本站发布的图片视频文字,以转载和分享为主,文章观点不代表本站立场,本站不承担相关法律责任;如果涉及侵权请联系邮箱:360163164@qq.com举报,并提供相关证据,经查实将立刻删除涉嫌侵权内容。

(0)
打赏 微信扫一扫 微信扫一扫
上一篇 05/14 16:34
下一篇 05/14 17:31

相关推荐