Difference between code for model & model summary?

My model:

class AnomalyDetector(Model):
    def __init__(self):
        super(AnomalyDetector, self).__init__()
        
        self.encoder = tf.keras.Sequential([
            Input(shape=(300, 300, 3)),
            Conv2D(64, (3, 3), activation='relu', padding='same'),
            MaxPooling2D((2, 2), padding='same'),
            BatchNormalization(),
            Conv2D(32, (3, 3), activation='relu', padding='same'),
            MaxPooling2D((2, 2), padding='same'),
            BatchNormalization(),
            Conv2D(16, (3, 3), activation='relu', padding='same'),
            MaxPooling2D((2, 2), padding='same')
            ]) # Smallest Layer Defined Here
    
        self.decoder = tf.keras.Sequential([
            Conv2D(64, (3, 3), activation='relu', padding='same'),
            UpSampling2D((2, 2)),
            Conv2D(32, (3, 3), activation='relu', padding='same'),
            UpSampling2D((2, 2)),
            Conv2D(16, (3, 3), activation='relu'),
            UpSampling2D((2, 2)),
            Conv2D(3, (3, 3), activation='sigmoid', padding='same')
            ])
    
    def call(self, x):
        encoded = self.encoder(x)
        decoded = self.decoder(encoded)
        return decoded

auto_encoder = AnomalyDetector()

But when I run,

print(auto_encoder.summary())

I get,

Model: "anomaly_detector"
_________________________________________________________________
 Layer (type)                Output Shape              Param #   
=================================================================
 sequential (Sequential)     (None, 38, 38, 16)        25264     
                                                                 
 sequential_1 (Sequential)   (None, 300, 300, 3)       32803     
                                                                 
=================================================================
Total params: 58,067
Trainable params: 57,875
Non-trainable params: 192
_________________________________________________________________
None

Am I right in thinking that this is just a summary of the last layer in self.encoder and the last layer in self.decoder?

Is there a way of getting the full layer list?

Hi @DrBwts, The combined model summary shows the input layer of the first sequential model and the output layer of the second sequential model.If you want to see all layers in the combined model use model.summary(expand_nested=True) which will display all the layers of the combined model. Please refer to this gist for working code example. Thank You.