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

Method testUpdateInput

tensorflow/python/framework/ops_test.py:848–874  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

846 self.evaluate(x)
847
848 def testUpdateInput(self):
849 g = ops.Graph()
850 with g.as_default():
851 x = constant_op.constant(1)
852 y = constant_op.constant(2)
853 z = x + y
854
855 z.op._update_input(0, y) # pylint: disable=protected-access
856 self.assertEquals(list(z.op.inputs), [y, y])
857 self.assertEquals(x.consumers(), [])
858 self.assertEquals(y.consumers(), [z.op, z.op])
859 with session.Session(graph=g) as sess:
860 self.assertEquals(self.evaluate(z), 4)
861
862 z.op._update_input(0, x) # pylint: disable=protected-access
863 self.assertEquals(list(z.op.inputs), [x, y])
864 self.assertEquals(x.consumers(), [z.op])
865 self.assertEquals(y.consumers(), [z.op])
866 with session.Session(graph=g) as sess:
867 self.assertEquals(self.evaluate(z), 3)
868
869 z.op._update_input(1, y) # pylint: disable=protected-access
870 self.assertEquals(list(z.op.inputs), [x, y])
871 self.assertEquals(x.consumers(), [z.op])
872 self.assertEquals(y.consumers(), [z.op])
873 with session.Session(graph=g) as sess:
874 self.assertEquals(self.evaluate(z), 3)
875
876 def testUpdateInputGraphError(self):
877 g_0 = ops.Graph()

Callers

nothing calls this directly

Calls 8

as_defaultMethod · 0.95
_update_inputMethod · 0.80
assertEqualsMethod · 0.80
GraphMethod · 0.45
constantMethod · 0.45
consumersMethod · 0.45
SessionMethod · 0.45
evaluateMethod · 0.45

Tested by

no test coverage detected