torchvirsion下载数据集
代码%matplotlib inline
import torch
import torchvision
from torch.utils import data
from torchvision import transforms
from d2l import torch as d2l
d2l.use_svg_display
trans = transforms.ToTensor
mnist_train=torchvision.datasets.FashionMNIST
(
root='./data',train=True,transform=trans,download=True
)
mnist_train=torchvision.datasets.FashionMNIST
(
root='./data',train=False,transform=trans,download=True
)
len(mnist_train),len(mnist_test)
mnist_train.shape 格式问题,把空格去掉就好
页:
[1]