Keras Model
s are Layer
s as well. So just create your models separately, and combine them in your meta model.
# model1
a = Input(shape=(...))
b = Dense()(a)
model1 = Model(inputs=a, outputs=b)
# model2
a = Input(shape=(...))
b = RNN(...)(a)
model2 = Model(inputs=a, outputs=b)
# combine them in meta model
inputs = tf.keras.Input(...)
x = model1(inputs)
y = model2(inputs)
meta = Add()([x, y])
meta = Dense()(meta)
model = tf.keras.Model(inputs=inputs, outputs=meta)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…