does it matter if weights are loaded after or before a model is compiled?

Viewed 157

I am using model.load_weights to load the weights of a keras model. I am wondering if it makes a difference if the weights are loaded before, or after the model is compiled.

1 Answers

No, it does not matter.

Compile defines the loss function, the optimizer and the metrics. If you compile a model after loading the weights, you will lose the optimizer states, but there is absolutely no damage to the weights.

It is explained in more in detail in this answer.

Related