def testAssignDependencyAcrossDevices(self):
    with self.test_session(use_gpu=True):
        var = state_ops.variable_op([1], dtypes.float32)
        state_ops.assign(var, [1.0]).eval()
        increment = state_ops.assign_add(var, [1.0])
        with ops.control_dependencies([increment]):
            with ops.device('/cpu:0'):
                result = math_ops.multiply(var, var)
        self.assertAllClose([4.0], result.eval())
def testAssignDependencyAcrossDevices(self):
    with self.test_session(use_gpu=True):
        var = state_ops.variable_op([1], dtypes.float32)
        state_ops.assign(var, [1.0]).eval()
        increment = state_ops.assign_add(var, [1.0])
        with ops.control_dependencies([increment]):
            with ops.device('/cpu:0'):
                result = math_ops.multiply(var, var)
        self.assertAllClose([4.0], result.eval())