(self)
| 60 | self.assertAllClose(a, xla.compile(fn)[0].eval({x: a})) |
| 61 | |
| 62 | def testMultiStack(self): |
| 63 | with self.session(), self.test_scope(): |
| 64 | v = array_ops.placeholder(dtypes.float32) |
| 65 | |
| 66 | def fn(): |
| 67 | h1 = gen_data_flow_ops.stack_v2(5, dtypes.float32, stack_name="foo") |
| 68 | c1 = gen_data_flow_ops.stack_push_v2(h1, v) |
| 69 | with ops.control_dependencies([c1]): |
| 70 | c1 = gen_data_flow_ops.stack_pop_v2(h1, dtypes.float32) |
| 71 | h2 = gen_data_flow_ops.stack_v2(5, dtypes.float32, stack_name="bar") |
| 72 | c2 = gen_data_flow_ops.stack_push_v2(h2, 5.0) |
| 73 | with ops.control_dependencies([c2]): |
| 74 | c2 = gen_data_flow_ops.stack_pop_v2(h2, dtypes.float32) |
| 75 | return c1 + c2 |
| 76 | |
| 77 | self.assertAllClose(9.0, xla.compile(fn)[0].eval({v: 4.0})) |
| 78 | |
| 79 | def testSameNameStacks(self): |
| 80 | """Different stacks with the same name do not interfere.""" |
nothing calls this directly
no test coverage detected