1. Dataset
提供一种方式去获取数据及其label.
- 如何获取每一个数据及其label
- 告诉我们总共有多少数据,才能知道迭代多少次
from torch.utils.data import Dataset
help(Dataset)
Dataset??
def __getitem__(self, index) -> T_co:
raise NotImplementedError
def __add__(self, other: 'Dataset[T_co]') -> 'ConcatDataset[T_co]':
return ConcatDataset([self, other])
2. Dataloader (加载器)
为后面的网络提供不同的数据形式, 对dataset中的数据进行打包.