您好,登錄后才能下訂單哦!
本篇內容主要講解“PyTorch torch.utils.data.Dataset怎么使用”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“PyTorch torch.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.Dataset
與 Dataloader
組合得到數據迭代器。在每次訓練時,利用這個迭代器輸出每一個 batch 數據,并能在輸出時對數據進行相應的預處理或數據增廣操作。
本文我們主要介紹對 torch.utils.data.Dataset 的理解,對 Dataloader 的介紹請參考我的另一篇文章:【PyTorch】torch.utils.data.DataLoader 簡單介紹與使用
在本文的最后將給出 torch.utils.data.Dataset
與 Dataloader
結合使用處理數據的實戰代碼。
pytorch 提供了一個數據讀取的方法,其由兩個類構成:torch.utils.data.Dataset 和 DataLoader。
如果我們要自定義自己讀取數據的方法,就需要繼承類 torch.utils.data.Dataset ,并將其封裝到DataLoader 中。
torch.utils.data.Dataset 是一個 類 Dataset 。通過重寫定義在該類上的方法,我們可以實現多種數據讀取及數據預處理方式。
torch.utils.data.Dataset 的源碼:
class Dataset(object): """An abstract class representing a Dataset. All other datasets should subclass it. All subclasses should override ``__len__``, that provides the size of the dataset, and ``__getitem__``, supporting integer indexing in range from 0 to len(self) exclusive. """ def __getitem__(self, index): raise NotImplementedError def __len__(self): raise NotImplementedError def __add__(self, other): return ConcatDataset([self, other])
注釋翻譯:
表示一個數據集的抽象類。
所有其他數據集都應該對其進行子類化。 所有子類都應該重寫提供數據集大小的 __len__
和 __getitem__
,支持從 0 到 len(self) 獨占的整數索引。
理解:
就是說,Dataset 是一個 數據集 抽象類,它是其他所有數據集類的父類(所有其他數據集類都應該繼承它),繼承時需要重寫方法 __len__
和 __getitem__
, __len__
是提供數據集大小的方法, __getitem__
是可以通過索引號找到數據的方法。
torch.utils.data.Dataset 是代表自定義數據集的抽象類,我們可以定義自己的數據類抽象這個類,只需要重寫__len__和__getitem__這兩個方法就可以。
要自定義自己的 Dataset 類,至少要重載兩個方法:__len__
, __getitem__
__len__返回的是數據集的大小
__getitem__實現索引數據集中的某一個數據
下面將簡單實現一個返回 torch.Tensor 類型的數據集:
from torch.utils.data import Dataset import torch class TensorDataset(Dataset): # TensorDataset繼承Dataset, 重載了__init__, __getitem__, __len__ # 實現將一組Tensor數據對封裝成Tensor數據集 # 能夠通過index得到數據集的數據,能夠通過len,得到數據集大小 def __init__(self, data_tensor, target_tensor): self.data_tensor = data_tensor self.target_tensor = target_tensor def __getitem__(self, index): return self.data_tensor[index], self.target_tensor[index] def __len__(self): return self.data_tensor.size(0) # size(0) 返回當前張量維數的第一維 # 生成數據 data_tensor = torch.randn(4, 3) # 4 行 3 列,服從正態分布的張量 print(data_tensor) target_tensor = torch.rand(4) # 4 個元素,服從均勻分布的張量 print(target_tensor) # 將數據封裝成 Dataset (用 TensorDataset 類) tensor_dataset = TensorDataset(data_tensor, target_tensor) # 可使用索引調用數據 print('tensor_data[0]: ', tensor_dataset[0]) # 可返回數據len print('len os tensor_dataset: ', len(tensor_dataset))
輸出結果:
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 文件:
from torch.utils.data import Dataset import pandas as pd # 這個包用來讀取CSV數據 # 繼承Dataset,定義自己的數據集類 mydataset class mydataset(Dataset): def __init__(self, csv_file): # self 參數必須,其他參數及其形式隨程序需要而不同,比如(self,*inputs) self.csv_data = pd.read_csv(csv_file) def __len__(self): return len(self.csv_data) def __getitem__(self, idx): data = self.csv_data.values[idx] return data data = mydataset('spambase.csv') print(data[3]) print(len(data))
輸出結果:
[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個標簽。
import torch.utils.data as Data import pandas as pd # 這個包用來讀取CSV數據 import torch # 繼承Dataset,定義自己的數據集類 mydataset class mydataset(Data.Dataset): def __init__(self, csv_file): # self 參數必須,其他參數及其形式隨程序需要而不同,比如(self,*inputs) data_csv = pd.DataFrame(pd.read_csv(csv_file)) # 讀數據 self.csv_data = data_csv.drop(axis=1, columns='58', inplace=False) # 刪除最后一列標簽 def __len__(self): return len(self.csv_data) def __getitem__(self, idx): data = self.csv_data.values[idx] return data data = mydataset('spambase.csv') x = torch.tensor(data[:5]) # 前五個數據 y = torch.tensor([1, 1, 1, 1, 1]) # 標簽 torch_dataset = Data.TensorDataset(x, y) # 對給定的 tensor 數據,將他們包裝成 dataset loader = Data.DataLoader( # 從數據庫中每次抽出batch size個樣本 dataset = torch_dataset, # torch TensorDataset format batch_size = 2, # mini batch size shuffle=True, # 要不要打亂數據 (打亂比較好) num_workers=2, # 多線程來讀數據 ) def show_batch(): for step, (batch_x, batch_y) in enumerate(loader): print("steop:{}, batch_x:{}, batch_y:{}".format(step, batch_x, batch_y)) show_batch()
輸出結果:
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。
import torch.utils.data as Data import pandas as pd # 這個包用來讀取CSV數據 import numpy as np # 繼承Dataset,定義自己的數據集類 mydataset class mydataset(Data.Dataset): def __init__(self, csv_file): # self 參數必須,其他參數及其形式隨程序需要而不同,比如(self,*inputs) # 讀取數據 frame = pd.DataFrame(pd.read_csv('spambase.csv')) spam = frame[frame['58'] == 1] ham = frame[frame['58'] == 0] SpamNew = spam.drop(axis=1, columns='58', inplace=False) # 刪除第58列,inplace=False不改變原數據,返回一個新dataframe HamNew = ham.drop(axis=1, columns='58', inplace=False) # 數據 self.csv_data = np.vstack([np.array(SpamNew), np.array(HamNew)]) # 將兩個N維數組進行連接,形成X # 標簽 self.Label = np.array([1] * len(spam) + [0] * len(ham)) # 形成標簽值列表y def __len__(self): return len(self.csv_data) def __getitem__(self, idx): data = self.csv_data[idx] label = self.Label[idx] return data, label data = mydataset('spambase.csv') print(len(data)) loader = Data.DataLoader( # 從數據庫中每次抽出batch size個樣本 dataset = data, # torch TensorDataset format batch_size = 460, # mini batch size shuffle=True, # 要不要打亂數據 (打亂比較好) num_workers=2, # 多線程來讀數據 ) def show_batch(): for step, (batch_x, batch_y) in enumerate(loader): print("steop:{}, batch_x:{}, batch_y:{}".format(step, batch_x, batch_y)) show_batch()
輸出結果:
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,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0, 0,
0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 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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+00, 3.3000e+01,
1.7700e+02],
[2.6000e-01, 4.6000e-01, 9.9000e-01, ..., 1.3235e+01, 2.7200e+02,
1.5750e+03],
[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,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 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 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,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1, 0, 0, 0, 0,
1, 1, 0, 0])
steop:5, batch_x:tensor([[7.0000e-01, 0.0000e+00, 1.0500e+00, ..., 1.1660e+00, 1.3000e+01,
1.8900e+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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0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 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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 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1,
0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 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, 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000e+00, 0.0000e+00, ..., 1.0000e+00, 1.0000e+00,
5.0000e+00],
[0.0000e+00, 0.0000e+00, 2.0000e-01, ..., 1.1870e+00, 1.1000e+01,
1.1400e+02],
...,
[0.0000e+00, 0.0000e+00, 0.0000e+00, ..., 2.3070e+00, 1.6000e+01,
3.0000e+01],
[5.1000e-01, 4.3000e-01, 2.9000e-01, ..., 6.5900e+00, 7.3900e+02,
2.3330e+03],
[6.8000e-01, 6.8000e-01, 6.8000e-01, ..., 2.4720e+00, 9.0000e+00,
8.9000e+01]], dtype=torch.float64), batch_y:tensor([0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0,
0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1,
1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0,
0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0,
0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1,
0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1,
0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1,
1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0,
1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 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 。
到此,相信大家對“PyTorch torch.utils.data.Dataset怎么使用”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。