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

Method testIncorrectGraph

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

Source from the content-addressed store, hash-verified

1641 self.assertEqual(45.0, sess.run(r'f:0'))
1642
1643 def testIncorrectGraph(self):
1644 with ops.Graph().as_default() as g_1:
1645 c_1 = constant_op.constant(1.0, name='c')
1646
1647 with ops.Graph().as_default() as g_2:
1648 c_2 = constant_op.constant(2.0, name='c')
1649
1650 self.assertEqual('c', c_1.op.name)
1651 self.assertEqual('c', c_2.op.name)
1652
1653 with session.Session(graph=g_1) as sess_1:
1654 self.assertEqual(1.0, sess_1.run(c_1))
1655 with self.assertRaises(ValueError):
1656 sess_1.run(c_2)
1657 with self.assertRaises(ValueError):
1658 sess_1.run(c_2.op)
1659
1660 with session.Session(graph=g_2) as sess_2:
1661 with self.assertRaises(ValueError):
1662 sess_2.run(c_1)
1663 with self.assertRaises(ValueError):
1664 sess_2.run(c_1.op)
1665 self.assertEqual(2.0, sess_2.run(c_2))
1666
1667 def testFeedDictKeyException(self):
1668 with session.Session() as sess:

Callers

nothing calls this directly

Calls 5

as_defaultMethod · 0.45
GraphMethod · 0.45
constantMethod · 0.45
SessionMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected