📜  keras 声明功能模型 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:10.426000             🧑  作者: Mango

代码示例1
# The Keras functional API is a lot more flexible than the Sequential API
from keras.models import Model
from keras.layers import Input
from keras.layers import Dense

# Declared the input layer with input shape 2
visible = Input(shape=(2,))
# Fed the output of the input layer into a hidden layer of size 2
hidden = Dense(2)(visible)
# Defined an actual model out of the above with an output being the same shape as the above layer and input being the size as the input layer
model = Model(inputs=visible, outputs=hidden)