How to convert model in eager execution to static graph and save in .pb file?
问题 Imagine that I have model (tf.keras.Model): class ContextExtractor(tf.keras.Model): def __init__(self): super().__init__() self.model = self.__get_model() def call(self, x, training=False, **kwargs): features = self.model(x, training=training) return features def __get_model(self): return self.__get_small_conv() def __get_small_conv(self): model = tf.keras.Sequential() model.add(layers.Conv2D(32, (3, 3), strides=(2, 2), padding='same')) model.add(layers.LeakyReLU(alpha=0.2)) model.add(layers