3

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.

SantoshGupta7
  • 5,607
  • 14
  • 58
  • 116

1 Answers1

5

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.

Pedrolarben
  • 1,205
  • 10
  • 19