@test_util.run_v1_only('b/120545219')
def testControlFlowInitialization(self):
    'Expects an error if an initializer is in a control-flow scope.'

    def cond(i, _):
        return (i < 10)

    def body(i, _):
        zero = array_ops.zeros([], dtype=dtypes.int32)
        v = variables.Variable(initial_value=zero)
        return ((i + 1), v.read_value())
    with self.assertRaisesRegex(ValueError, 'inside a control-flow'):
        control_flow_ops.while_loop(cond, body, [0, 0])
Expects an error if an initializer is in a control-flow scope.
@test_util.run_v1_only('b/120545219')
def testControlFlowInitialization(self):
    

    def cond(i, _):
        return (i < 10)

    def body(i, _):
        zero = array_ops.zeros([], dtype=dtypes.int32)
        v = variables.Variable(initial_value=zero)
        return ((i + 1), v.read_value())
    with self.assertRaisesRegex(ValueError, 'inside a control-flow'):
        control_flow_ops.while_loop(cond, body, [0, 0])