import torch
from torch import nn
from torch.utils.data import DataLoader
from torchvision import datasets
from torchvision.transforms import ToTensor, Lambda, Compose
import matplotlib.pyplot as plt
1. DataLoader
是Pytorch用来加载数据的常用的类,返回一个可遍历的数据集对象
传入参数:
-
dataset (Dataset) – dataset from which to load the data.
-
batch_size (int, optional) – how many samples per batch to load (default:
1
). -
shuffle (bool, optional) – set to
True
to have the data reshuffled at every epoch (default:False
)
2. torchvision
是一个包,里面包含了很多常用的视觉数据集