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

Method testDeferredBuild

tensorflow/python/training/saver_test.py:652–671  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

650 saver.save(sess, save_path)
651
652 def testDeferredBuild(self):
653 save_path = os.path.join(self.get_temp_dir(), "deferred_build")
654 with session.Session("", graph=ops_lib.Graph()) as sess:
655 one = variables.VariableV1(1.0)
656 save = saver_module.Saver(defer_build=True)
657 # if build is not deferred, saver cannot save the `twos`.
658 twos = variables.VariableV1([2.0, 2.0, 2.0])
659 init = variables.global_variables_initializer()
660 save.build()
661 init.run()
662 save.save(sess, save_path)
663
664 with session.Session("", graph=ops_lib.Graph()) as sess:
665 one = variables.VariableV1(0.0)
666 twos = variables.VariableV1([0.0, 0.0, 0.0])
667 # Saver with no arg, defaults to 'all variables'.
668 save = saver_module.Saver()
669 save.restore(sess, save_path)
670 self.assertAllClose(1.0, self.evaluate(one))
671 self.assertAllClose([2.0, 2.0, 2.0], self.evaluate(twos))
672
673 @test_util.run_v1_only("b/120545219")
674 def testReshape(self):

Callers

nothing calls this directly

Calls 10

buildMethod · 0.95
saveMethod · 0.95
restoreMethod · 0.95
get_temp_dirMethod · 0.80
joinMethod · 0.45
SessionMethod · 0.45
GraphMethod · 0.45
runMethod · 0.45
assertAllCloseMethod · 0.45
evaluateMethod · 0.45

Tested by

no test coverage detected