def test_run(self):
     with self.test_session() as sess:
         c = tf.constant(0)
         v = tf.identity(c)
         self.assertEqual(42, sess.run(v, feed_dict={c: 42}))
         wrapped_sess = monitored_session._WrappedSession(sess)
         self.assertEqual(51, wrapped_sess.run(v, feed_dict={c: 51}))
Ejemplo n.º 2
0
 def test_run(self):
   with self.test_session() as sess:
     c = tf.constant(0)
     v = tf.identity(c)
     self.assertEqual(42, sess.run(v, feed_dict={c: 42}))
     wrapped_sess = monitored_session._WrappedSession(sess)
     self.assertEqual(51, wrapped_sess.run(v, feed_dict={c: 51}))
 def test_close_twice(self):
     with self.test_session() as sess:
         wrapped_sess = monitored_session._WrappedSession(sess)
         wrapped_sess.close()
         self.assertTrue(wrapped_sess.should_stop())
         wrapped_sess.close()
         self.assertTrue(wrapped_sess.should_stop())
Ejemplo n.º 4
0
 def test_close_twice(self):
   with self.test_session() as sess:
     wrapped_sess = monitored_session._WrappedSession(sess)
     wrapped_sess.close()
     self.assertTrue(wrapped_sess.should_stop())
     wrapped_sess.close()
     self.assertTrue(wrapped_sess.should_stop())
 def test_should_stop_delegates_to_wrapped_session(self):
     with self.test_session() as sess:
         wrapped_sess0 = StopAtNSession(sess, 4)
         wrapped_sess1 = monitored_session._WrappedSession(wrapped_sess0)
         self.assertFalse(wrapped_sess1.should_stop())
         self.assertFalse(wrapped_sess1.should_stop())
         self.assertFalse(wrapped_sess1.should_stop())
         self.assertFalse(wrapped_sess1.should_stop())
         self.assertTrue(wrapped_sess1.should_stop())
Ejemplo n.º 6
0
 def test_should_stop_delegates_to_wrapped_session(self):
   with self.test_session() as sess:
     wrapped_sess0 = StopAtNSession(sess, 4)
     wrapped_sess1 = monitored_session._WrappedSession(wrapped_sess0)
     self.assertFalse(wrapped_sess1.should_stop())
     self.assertFalse(wrapped_sess1.should_stop())
     self.assertFalse(wrapped_sess1.should_stop())
     self.assertFalse(wrapped_sess1.should_stop())
     self.assertTrue(wrapped_sess1.should_stop())
 def test_properties(self):
     with self.test_session() as sess:
         tf.constant(0.0)
         wrapped_sess = monitored_session._WrappedSession(sess)
         self.assertEquals(sess.graph, wrapped_sess.graph)
         self.assertEquals(sess.sess_str, wrapped_sess.sess_str)
Ejemplo n.º 8
0
 def test_properties(self):
   with self.test_session() as sess:
     tf.constant(0.0)
     wrapped_sess = monitored_session._WrappedSession(sess)
     self.assertEquals(sess.graph, wrapped_sess.graph)
     self.assertEquals(sess.sess_str, wrapped_sess.sess_str)