Reset state trackers for model. Note that we do not actually zero out attributes such as optimizer, but instead rely on the expectation that all of the attrs will be over-written on calling build/compile/etc. This is somewhat fragile, insofar as we check elsewhere for the presence of these
(model)
| 508 | |
| 509 | |
| 510 | def _reset_build_compile_trackers(model): |
| 511 | """Reset state trackers for model. |
| 512 | |
| 513 | Note that we do not actually zero out attributes such as optimizer, |
| 514 | but instead rely on the expectation that all of the attrs will be |
| 515 | over-written on calling build/compile/etc. This is somewhat fragile, |
| 516 | insofar as we check elsewhere for the presence of these attributes as |
| 517 | evidence of having been built/compiled/etc. Pending a better way to do this, |
| 518 | we reset key attributes here to allow building and compiling. |
| 519 | |
| 520 | Args: |
| 521 | model: the model that is being reset |
| 522 | """ |
| 523 | # Reset build state |
| 524 | model.built = False |
| 525 | model.inputs = None |
| 526 | model.outputs = None |
| 527 | # Reset compile state |
| 528 | model._is_compiled = False # pylint:disable=protected-access |
| 529 | model.optimizer = None |
| 530 | |
| 531 | |
| 532 | def in_place_subclassed_model_state_restoration(model): |
no outgoing calls
no test coverage detected