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

Method testVariableOnly

tensorflow/python/eager/function_test.py:153–160  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

151 self.assertEqual(3.0, self.evaluate(r))
152
153 def testVariableOnly(self):
154 v = variables.Variable(1.0)
155 add = def_function.function(lambda x: x.assign_add(1.0))
156 r1 = add(v)
157 self.assertEqual(2.0, self.evaluate(r1))
158 c = constant_op.constant(1.0)
159 with self.assertRaisesRegexp(AttributeError, 'no attribute'):
160 add(c)
161
162 def testExternalControlDependency(self):
163 with ops.Graph().as_default(), self.test_session():

Callers

nothing calls this directly

Calls 6

VariableMethod · 0.80
addFunction · 0.50
functionMethod · 0.45
assign_addMethod · 0.45
evaluateMethod · 0.45
constantMethod · 0.45

Tested by

no test coverage detected