import torch
import torchvision
from torch import nn
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
from torchvision.transforms import transforms
import time
# 下载训练集和验证集
train_data = torchvision.datasets.CIFAR10('./dataset',train=True,transform=transforms.Compose([
transforms.ToTensor(),
transforms.Normalize((0.5,0.5,0.5),(0.5,0.5,0.5))
]),download=True)
test_data = torchvision.datasets.CIFAR10('./dataset',train=False,transform=transforms.Compose([
transforms.ToTensor(),
transforms.Normalize((0.5,0.5,0.5),(0.5,0.5,0.5))
]),download=True)
print(len(train_data))
print(len(test_data))
pytorch学习(一):对cifar10数据分类
最新推荐文章于 2023-11-01 17:28:03 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)