(self)
| 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): |
nothing calls this directly
no test coverage detected