Why does keras.Model subclass behave differently to the sequential API?
I create two new objects in call(): layers.Flatten and layers.Dense. When I create the objects in the constructor, the model works as expected.
class CriticModel(Model):

    def __init__(self, channel):
        super(CriticModel, self).__init__()
        self.cnn1 = CNNBlock(channel[0])
        self.cnn2 = CNNBlock(channel[1])
        self.flat = layers.Flatten()
        self.dense = layers.Dense(1)


    def call(self, input_tensor, training=False, mask=None):
        x = self.cnn1(input_tensor, training=training)
        x = self.cnn2(x, training=training)
        # x = layers.Flatten()(x) &lt;-- This creates a new obj at eacht forward call
        # x = layers.Dense(1)(x)  &lt;-- This creates a new obj at eacht forward call
        x = self.flat(x)
        x = self.dense(x)
        return x

    def get_config(self):
        super(CriticModel, self).get_config()
```