深度学习-pytorch-经典CNN模型-AlexNet
AlexNet模型
概述
代码实现
1 | import torch |
1 | X = torch.randn(1, 1, 224, 224) |
Conv2d Output shape: torch.Size([1, 96, 54, 54])
ReLU Output shape: torch.Size([1, 96, 54, 54])
MaxPool2d Output shape: torch.Size([1, 96, 26, 26])
Conv2d Output shape: torch.Size([1, 256, 26, 26])
ReLU Output shape: torch.Size([1, 256, 26, 26])
MaxPool2d Output shape: torch.Size([1, 256, 12, 12])
Conv2d Output shape: torch.Size([1, 384, 12, 12])
ReLU Output shape: torch.Size([1, 384, 12, 12])
Conv2d Output shape: torch.Size([1, 384, 12, 12])
ReLU Output shape: torch.Size([1, 384, 12, 12])
Conv2d Output shape: torch.Size([1, 256, 12, 12])
ReLU Output shape: torch.Size([1, 256, 12, 12])
MaxPool2d Output shape: torch.Size([1, 256, 5, 5])
Flatten Output shape: torch.Size([1, 6400])
Linear Output shape: torch.Size([1, 4096])
ReLU Output shape: torch.Size([1, 4096])
Dropout Output shape: torch.Size([1, 4096])
Linear Output shape: torch.Size([1, 4096])
ReLU Output shape: torch.Size([1, 4096])
Dropout Output shape: torch.Size([1, 4096])
Linear Output shape: torch.Size([1, 10])
拿Fashion-MINST的数据集跑一下
1 | def get_dataloader_workers(): |
1 | lr, num_epochs = 0.05, 10 |
由于手头上的电脑没有独立显卡,这是沐神的截图
(鼠鼠暂时没有能跑cuda的机器,只能拿李沐老师的运行效果图充数了QAQ)今晚就去给拯救者配置cuda环境(逃)
2022/8/18日更新
我回来辣
成功在游戏本上安装pytorch运行环境,并且可以使用cuda
电脑所支持的cuda版本
电脑所装的的cuda版本
从pytorch官网装的是pytorch11.6版本(向下兼容)
我们来看一下运行效果(装了一下午加一晚上人整麻了)
运行时间
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment