Commit 8745e342 authored by Allen Lavoie's avatar Allen Lavoie Committed by TensorFlower Gardener
Browse files

Object-based saving: Switch to "everything is Checkpointable"

The only sane way to use/test this is to have Variables be Checkpointable, so this CL includes a move of the base class to core. No public methods are exposed, and I've attempted to not throw any errors on __setattr__.

Allows dynamic dependencies (track after restore) and restoring variables on assignment to a Checkpointable object, and includes the protocol buffer modifications necessary for saving information with each object.

There are still some prominent TODOs:
 - Stop modifying the graph after the first save/restore (likely cache ops in Checkpointable objects)
 - Add some overridable methods for saving Python strings when restore() is called, fed when graph building rather than embedded as constants in the graph
 - Work on the initialization story for graph building. Currently the unit tests rely on collections for this.
 - Support for more objects, move the prototype modifications in checkpointable_test to core.

The diff is larger than I was hoping (mostly deletions and unit tests); that could be reduced a bit (or at least "lines added" converted to "lines deleted") by diffbasing on cl/180950921, which was my first attempt at dynamic dependencies. This CL is more of a re-write than a modification, so sending that one out seems a bit silly. The unit tests are still good, though.

PiperOrigin-RevId: 185893387
parent 82d67d0a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment