what do we actually pass in tf.keras.models.Model as an input…?? is it the images we pass to it and get output through output_layer.
Here is the code:
successive_outputs = [layer.output for layer in model.layers]
visualization_model = tf.keras.models.Model(inputs = model.input, outputs = successive_outputs)
When we pass an input (image for example) through a model, each layer emits an output. Usually, we use the final layer for tasks like classification.
To inspect what a layer emits, we capture output of a layer via layer.output.
visualization_model will take as input the same image you pass through the model and emits a list of outputs, each of which corresponds to the output of a layer.