If yes, then, how did they do that? I mean, say that I have a custom-built model via subclassing. My optimizer is a separated object. How is it that one command save weights of two different objects? In particular, how does it know that those two objects are related? Is it due to magic done by model.compile?
EDIT: I just realized that a model has an attribute model.optimizer, is that how Keras do it? make the optimizer an attribute of a model and will be saved with it?