python - Pytorch 神经网络,理解全连接层
问题描述
def __init__(self):
super(Net, self).__init__()
# 1 input image channel, 6 output channels, 3x3 square convolution
# kernel
self.conv1 = nn.Conv2d(1, 6, 3)
self.conv2 = nn.Conv2d(6, 16, 3)
# an affine operation: y = Wx + b
self.fc1 = nn.Linear(16 * 6 * 6, 120) # 6*6 from image dimension
self.fc2 = nn.Linear(120, 84)
self.fc3 = nn.Linear(84, 10)
从上面 PyTorch 神经网络教程的图像和代码,我可以理解卷积的维度。'nn.Linear' 的输出维度是如何确定的?另外,为什么我们需要三个全连接层?
任何帮助将不胜感激。TIA
解决方案
推荐阅读
- knex.js - 更新 Morph-One 关联模型并收到“未处理的拒绝错误”
- c++ - 在 OpenGL、GLSL 中翻译蒙版并转换其后面的对象
- verilog - Verilog中的整数和reg变量类型有什么区别?
- redirect - React Router-根据浏览器类型路由不同的页面
- spring-boot - 嗨,我是 Spring Boot 的新手。我需要创建一个休息模板客户端,它可以从提供给我的 api 链接获取 oauth2 访问令牌
- javascript - 子组件无法访问对象的属性
- flutter - ThemeData - 不推荐使用的标题参数
- javascript - 不从 JQuery 对象中提取任何数据
- python - 如何使用列表推导来改变原始列表
- bash - 如何使while循环返回开始以及如何在循环中添加循环