- Deep Learning with PyTorch Quick Start Guide
- David Julian
- 192字
- 2021-07-02 15:00:12
PyTorch dataset loaders
Pytorch includes data loaders for several datasets to help you get started. The torch.dataloader is the class used for loading datasets. The following is a list of the included torch datasets and a brief description:

Here is a typical example of how we load one of these datasets into PyTorch:

CIFAR10 is a torch.utils.dataset object. Here, we are passing it four arguments. We specify a root directory relative to where the code is running, a Boolean, train, indicating if we want the test or training set loaded, a Boolean that, if set to True, will check to see if the dataset has previously been downloaded and if not download it, and a callable transform. In this case, the transform we select is ToTensor(). This is an inbuilt class of torchvision.transforms that makes the class return a tensor. We will discuss transforms in more detail later in the chapter.
The contents of the dataset can be retrieved by a simple index lookup. We can also check the length of the entire dataset with the len function. We can also loop through the dataset in order. The following code demonstrates this:

- 電氣自動化專業英語(第3版)
- Dreamweaver CS3 Ajax網頁設計入門與實例詳解
- 輕輕松松自動化測試
- STM32G4入門與電機控制實戰:基于X-CUBE-MCSDK的無刷直流電機與永磁同步電機控制實現
- 可編程控制器技術應用(西門子S7系列)
- 大數據驅動的設備健康預測及維護決策優化
- 信息物理系統(CPS)測試與評價技術
- 大數據驅動的機械裝備智能運維理論及應用
- Mastering Geospatial Analysis with Python
- 嵌入式Linux系統實用開發
- 中文版AutoCAD 2013高手速成
- 筆記本電腦使用與維護
- 計算機組裝與維修實訓
- 智能+:制造業的智能化轉型
- Getting Started with Tableau 2019.2