文章目录
- 简单的层的堆叠,本层只从上一层接收,只传递到下一层。
- 单输入,单输出
model = keras.Sequential([layers.Input(shape=(4,)),layers.Dense(2, activation="relu"),layers.Dense(3, activation="relu"),layers.Dense(4),
])model.summary()
''' Model: "sequential" _________________________________________________________________ Layer (type) Output Shape Param # ================================================================= dense (Dense) (None, 2) 10 _________________________________________________________________ dense_1 (Dense) (None, 3) 9 _________________________________________________________________ dense_2 (Dense) (None, 4) 16 ================================================================= Total params: 35 Trainable params: 35 Non-trainable params: 0 _________________________________________________________________ '''
不在模型中指定输入层keras.Input(shape=(4,)),
,算是还没建完的半成品,model.summary()
就会报错。