Esempio n. 1
0
 def test_do_not_stop_if_checkpoint_is_not_there(self):
     with ops.Graph().as_default():
         step = training.create_global_step()
         assign_ten = step.assign(10)
         no_op = control_flow_ops.no_op()
         hook = hooks_lib._StopAtCheckpointStepHook(
             model_dir=tempfile.mkdtemp(), last_step=10)
         with training.SingularMonitoredSession(hooks=[hook]) as mon_sess:
             mon_sess.raw_session().run(assign_ten)
             with test.mock.patch.object(time, 'sleep') as mock_sleep:
                 mon_sess.run(no_op)
                 self.assertTrue(mock_sleep.called)
             self.assertFalse(mon_sess.should_stop())
Esempio n. 2
0
 def test_do_not_stop_if_checkpoint_is_not_there(self):
   with ops.Graph().as_default():
     step = training.create_global_step()
     assign_ten = step.assign(10)
     no_op = control_flow_ops.no_op()
     hook = hooks_lib._StopAtCheckpointStepHook(
         model_dir=tempfile.mkdtemp(), last_step=10)
     with training.SingularMonitoredSession(hooks=[hook]) as mon_sess:
       mon_sess.raw_session().run(assign_ten)
       with test.mock.patch.object(time, 'sleep') as mock_sleep:
         mon_sess.run(no_op)
         self.assertTrue(mock_sleep.called)
       self.assertFalse(mon_sess.should_stop())