(self)
| 165 | self.assertEqual(e, a) |
| 166 | |
| 167 | def test_setup(self): |
| 168 | with Task() as task: |
| 169 | with ops.task_init(): |
| 170 | one = ops.Const(1) |
| 171 | two = ops.Add([one, one]) |
| 172 | with ops.task_init(): |
| 173 | three = ops.Const(3) |
| 174 | accum = ops.Add([two, three]) |
| 175 | # here, accum should be 5 |
| 176 | with ops.task_exit(): |
| 177 | # here, accum should be 6, since this executes after lines below |
| 178 | seven_1 = ops.Add([accum, one]) |
| 179 | six = ops.Add([accum, one]) |
| 180 | ops.Add([accum, one], [accum]) |
| 181 | seven_2 = ops.Add([accum, one]) |
| 182 | o6 = final_output(six) |
| 183 | o7_1 = final_output(seven_1) |
| 184 | o7_2 = final_output(seven_2) |
| 185 | with LocalSession() as session: |
| 186 | session.run(task) |
| 187 | self.assertEqual(o6.fetch(), 6) |
| 188 | self.assertEqual(o7_1.fetch(), 7) |
| 189 | self.assertEqual(o7_2.fetch(), 7) |
| 190 | |
| 191 | def test_multi_instance_python_op(self): |
| 192 | """ |
nothing calls this directly
no test coverage detected