MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _reset_build_compile_trackers

Function _reset_build_compile_trackers

tensorflow/python/keras/models.py:510–529  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

508
509
510def _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
532def in_place_subclassed_model_state_restoration(model):

Calls

no outgoing calls

Tested by

no test coverage detected