@test_util.run_v1_only('b/120545219')
def testVariableDefInitializedInstances(self):
    with ops.Graph().as_default(), self.cached_session() as sess:
        v_def = variables.Variable(initial_value=constant_op.constant(3.0)).to_proto()
    with ops.Graph().as_default(), self.cached_session() as sess:
        v = variables.Variable(variable_def=v_def)
        self.assertEqual(3.0, self.evaluate(v.initialized_value()))
        self.evaluate(v.assign(1.0))
        self.assertEqual(1.0, self.evaluate(v.initialized_value()))
    v_def.ClearField('initial_value_name')
    with ops.Graph().as_default(), self.cached_session() as sess:
        v = variables.Variable(variable_def=v_def)
        self.assertProtoEquals(v_def, v.to_proto())
        with self.assertRaises(ValueError):
            self.evaluate(v.initialized_value())
@test_util.run_v1_only('b/120545219')
def testVariableDefInitializedInstances(self):
    with ops.Graph().as_default(), self.cached_session() as sess:
        v_def = variables.Variable(initial_value=constant_op.constant(3.0)).to_proto()
    with ops.Graph().as_default(), self.cached_session() as sess:
        v = variables.Variable(variable_def=v_def)
        self.assertEqual(3.0, self.evaluate(v.initialized_value()))
        self.evaluate(v.assign(1.0))
        self.assertEqual(1.0, self.evaluate(v.initialized_value()))
    v_def.ClearField('initial_value_name')
    with ops.Graph().as_default(), self.cached_session() as sess:
        v = variables.Variable(variable_def=v_def)
        self.assertProtoEquals(v_def, v.to_proto())
        with self.assertRaises(ValueError):
            self.evaluate(v.initialized_value())