- 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:

- Hadoop 2.x Administration Cookbook
- 人工智能工程化:應(yīng)用落地與中臺(tái)構(gòu)建
- SharePoint 2010開(kāi)發(fā)最佳實(shí)踐
- 統(tǒng)計(jì)學(xué)習(xí)理論與方法:R語(yǔ)言版
- 電腦主板現(xiàn)場(chǎng)維修實(shí)錄
- ESP8266 Home Automation Projects
- 工業(yè)控制系統(tǒng)測(cè)試與評(píng)價(jià)技術(shù)
- Visual Basic.NET程序設(shè)計(jì)
- Linux嵌入式系統(tǒng)開(kāi)發(fā)
- Apache源代碼全景分析(第1卷):體系結(jié)構(gòu)與核心模塊
- 電氣控制與PLC原理及應(yīng)用(歐姆龍機(jī)型)
- Excel 2007終極技巧金典
- 計(jì)算機(jī)硬件技術(shù)基礎(chǔ)學(xué)習(xí)指導(dǎo)與練習(xí)
- Generative Adversarial Networks Projects
- Java Deep Learning Projects