I have two sequential networks (encoder network and decoder network). How can I use the sequential API to create the autoencoder model?
Please don't recommend using the functional API or explain the benefits of functional over sequential, because this is not the question here.
encoder_network = tf.keras.Sequential([
Conv2D(64, 3, padding='same', activation="swish"),
DownscaleBlock(1),
DownscaleBlock(2),
Conv2D(128, 3, padding='same', activation="swish"),
Conv2D(32, 3, padding='same', activation="swish"),
Conv2D(10, 3, padding='same'),
])
decoder_network = tf.keras.Sequential([
Conv2D(4, 3, padding='same', activation="swish"),
Conv2D(16, 3, padding='same', activation="swish"),
Conv2D(64, 3, padding='same', activation="swish"),
UpscaleBlock(1),
UpscaleBlock(2),
Conv2D(4, 3, padding='same', activation="swish"),
Conv2D(1, 3, padding='same'),
])
You can use your models like they were layers:
model = tf.keras.Sequential([
encoder_network,
decoder_network
])