Verifies against `Failed precondition: Expected one input shape`.
(self)
| 300 | xla_context.Exit() |
| 301 | |
| 302 | def testCondNoInputs(self): |
| 303 | """Verifies against `Failed precondition: Expected one input shape`.""" |
| 304 | |
| 305 | with self.session(), self.test_scope(): |
| 306 | xla_context = control_flow_ops.XLAControlFlowContext() |
| 307 | xla_context.Enter() |
| 308 | |
| 309 | for pred in True, False: |
| 310 | cond_out = control_flow_ops.cond( |
| 311 | array_ops.placeholder_with_default(pred, []), |
| 312 | lambda: constant_op.constant(2.), |
| 313 | lambda: constant_op.constant(1.)) |
| 314 | self.assertEqual(int(pred) + 1., self.evaluate(cond_out)) |
| 315 | |
| 316 | xla_context.Exit() |
| 317 | |
| 318 | |
| 319 | if __name__ == '__main__': |