(self)
| 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(): |