diff options
author | 2018-08-27 16:47:28 -0700 | |
---|---|---|
committer | 2018-08-27 16:51:39 -0700 | |
commit | f577ae972f457cd7ba8dc8be14a80d8d6e27b8cb (patch) | |
tree | 788af09acc7cce36e479dd8a0a2af0ff6dc856df /tensorflow/python/training/checkpointable/util_test.py | |
parent | 9500c1d80de70dabd1b538287a667c6fda0c394d (diff) |
Checkpointable: Fix the ignore-missing logic for name-based checkpoint restores
Restore previously checked if a key existed, but didn't quite ignore that value properly if it was missing.
PiperOrigin-RevId: 210455409
Diffstat (limited to 'tensorflow/python/training/checkpointable/util_test.py')
-rw-r--r-- | tensorflow/python/training/checkpointable/util_test.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tensorflow/python/training/checkpointable/util_test.py b/tensorflow/python/training/checkpointable/util_test.py index 697b44c3ff..bef4bf2a16 100644 --- a/tensorflow/python/training/checkpointable/util_test.py +++ b/tensorflow/python/training/checkpointable/util_test.py @@ -1482,6 +1482,12 @@ class CheckpointCompatibilityTests(test.TestCase): status = object_saver.restore(save_path) status.initialize_or_restore() self._check_sentinels(root) + # Check that there is no error when keys are missing from the name-based + # checkpoint. + root.not_in_name_checkpoint = resource_variable_ops.ResourceVariable([1.]) + status = object_saver.restore(save_path) + with self.assertRaises(AssertionError): + status.assert_existing_objects_matched() def testSaveGraphLoadEager(self): checkpoint_directory = self.get_temp_dir() |