Problem Summarization
I created keras model using functional API without any error.
But when I call the model.summary(), there is not any layers but only parameters exists.
When I call the model.layers, empty list is returned.
For example, I created simple mlp model.
input = Input(shape = (20,))
x = Dense(30, name = 'dense1')(input)
x = Dense(20, name = 'dense2')(x)
output = Dense(1)(x)
model = keras.models.Model(inputs = input ,outputs = output)
model.compile(loss = 'mse', optimizer = 'adam')
code above is executed without any error. but when I call summary method or layers method, not any layers come up.
model.layers
-> []
model.summary()
-> Model: "model"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
Total params: 1,271
Trainable params: 1,271
Non-trainable params: 0
_________________________________________________________________
but this model is able to be trained and inference despite not having any layers. And much more weird thing is that This happens only on Google colab pro. In the kaggle kernel, the same code creates all layers without any problem.
To make more complicated model with functional API, layers have to be exist. Is there anybody knows the reason why this happens on google colab?