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

Method testNotEntered

tensorflow/python/client/session_test.py:1285–1298  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1283
1284 @test_util.run_v1_only('b/120545219')
1285 def testNotEntered(self):
1286 # pylint: disable=protected-access
1287 self.assertEqual(ops._default_session_stack.get_default(), None)
1288 # pylint: enable=protected-access
1289 with ops.device('/cpu:0'):
1290 sess = session.Session()
1291 c_1 = constant_op.constant(5.0)
1292 with sess.graph.as_default():
1293 c_2 = constant_op.constant(5.0)
1294 self.assertEqual(c_1.graph, c_2.graph)
1295 self.assertEqual(sess.run(c_2), 5.0)
1296 with self.assertRaisesWithPredicateMatch(
1297 ValueError, lambda e: 'No default session is registered.' in str(e)):
1298 c_2.eval()
1299
1300 @test_util.run_v1_only('b/120545219')
1301 def testInteractive(self):

Callers

nothing calls this directly

Calls 8

runMethod · 0.95
get_defaultMethod · 0.45
deviceMethod · 0.45
SessionMethod · 0.45
constantMethod · 0.45
as_defaultMethod · 0.45
evalMethod · 0.45

Tested by

no test coverage detected