model.summary() can't print output shape while using subclass model
问题 This is the two methods for creating a keras model, but the output shapes of the summary results of the two methods are different. Obviously, the former prints more information and makes it easier to check the correctness of the network. import tensorflow as tf from tensorflow.keras import Input, layers, Model class subclass(Model): def __init__(self): super(subclass, self).__init__() self.conv = layers.Conv2D(28, 3, strides=1) def call(self, x): return self.conv(x) def func_api(): x = Input