我从这个例子中使用 Keras 训练了一个模型。模型摘要向我展示了这个结果
Model: "sequential_1"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
conv2d_1 (Conv2D) (None, 26, 26, 32) 320
_________________________________________________________________
conv2d_2 (Conv2D) (None, 24, 24, 64) 18496
_________________________________________________________________
max_pooling2d_1 (MaxPooling2 (None, 12, 12, 64) 0
_________________________________________________________________
dropout_1 (Dropout) (None, 12, 12, 64) 0
_________________________________________________________________
flatten_1 (Flatten) (None, 9216) 0
_________________________________________________________________
dense_1 (Dense) (None, 128) 1179776
_________________________________________________________________
dropout_2 (Dropout) (None, 128) 0
_________________________________________________________________
dense_2 (Dense) (None, 10) 1290
=================================================================
Total params: 1,199,882
Trainable params: 1,199,882
Non-trainable params: 0
有 8 层,model.get_weights()
也显示了 8 的第一个维度。正如我正确理解的那样,Pooling 和 Flatten 之类的东西是输入矩阵上的“运算符”,那么为什么它被呈现为一个层呢?如何理解权重数组中存储的内容,例如在池化层(model.get_weights()[2]
)中?