I would like to be able to reset the weights of my entire Keras model so that I do not have to compile it again. Compiling the model is currently the main bottleneck of my code. Here is an example of what I mean:
import tensorflow as tf model = tf.keras.Sequential([tf.keras.layers.Flatten(input_shape=(28, 28)),tf.keras.layers.Dense(16, activation='relu'),tf.keras.layers.Dense(10)
])model.compile(optimizer=tf.keras.optimizers.SGD(learning_rate=0.001),loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),metrics=['accuracy'])data = tf.keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = data.load_data()model.fit(x=x_train, y=y_train, epochs=10)# Reset all weights of model here
# model.reset_all_weights() <----- something like thatmodel.fit(x=x_train, y=y_train, epochs=10)