
pytorch
文章平均质量分 58
biggerbugger
这个作者很懒,什么都没留下…
展开
-
CNN---pytorch---MNIST---入门(简单)分类任务
分类任务MNIST一级目录定义模型训练网络一级目录# 导包import torchimport torchvisionimport torchvision.transforms as transformsdevice = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")print(device) # cuda:0# 下载数据、读取数据 transform = torchvision.transforms.Com原创 2021-03-06 15:42:51 · 363 阅读 · 0 评论 -
torch.max() x.item() x.sum() x.size(0) x.squeeze()
max item sum size squeezetorch.max()x.item()x.sum()x.size(0)x.squeeze()torch.max()torch.max(a,0)或torch.max(a,1)torch.max(a,0)返回行的最大值+最大值的索引torch.max(a,1)返回列的最大值+最大值的索引参考博客x.item()x.item() →获取x的值 只能是数值,不能是listx必须是tensor 且只能是数值x.sum()x.sum() →计算原创 2021-03-03 16:53:05 · 3021 阅读 · 3 评论 -
CIFAR10分类任务---pytorch---CNN---入门(简单)分类任务
本实验来自Pytorch官方教程中文版CIFAR10分类任务# 导包import torchimport torchvisionimport torchvision.transforms as transforms# device = torch.device("cuda:0") # 指定模型训练所在 GPUdevice = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")print(device) # c原创 2021-03-03 16:18:21 · 2167 阅读 · 1 评论 -
conda安装pytorch总是失败(下载中断)
conda安装pytorch总是失败(下载中断)出现问题:问题描述解决方法:第一步第二步第三步出现问题:问题描述使用命令conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch安装pytorch下载小文件没问题,但是下载大文件如pytorch就会下载一半就中断解决方法:第一步激活pytorch环境(这是自己创建的环境的名字)conda activate pytorch第二步设置超时时间 这一步非常重原创 2021-02-01 13:33:02 · 7210 阅读 · 2 评论