输出MLP模型摘要信息的代码
时间: 2024-02-01 13:14:31 浏览: 22
以下是使用Keras输出MLP模型摘要信息的示例代码:
```python
from keras.models import Sequential
from keras.layers import Dense
# 定义MLP模型
model = Sequential()
model.add(Dense(units=64, activation='relu', input_dim=100))
model.add(Dense(units=10, activation='softmax'))
# 输出模型摘要信息
model.summary()
```
运行上述代码,将会输出如下模型摘要信息:
```
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
dense_1 (Dense) (None, 64) 6464
_________________________________________________________________
dense_2 (Dense) (None, 10) 650
=================================================================
Total params: 7,114
Trainable params: 7,114
Non-trainable params: 0
_________________________________________________________________
```
其中,第一列表示每个层的名称和类型;第二列表示该层的输出形状;第三列表示该层的参数数量。我们可以根据这些信息来了解模型的结构和规模。