def METHOD_NAME(self, x_start, tol):
    """Tests that rmsprop optimizer takes one and two steps correctly
    for univariate functions."""
    stepsize, gamma = 0.1, 0.5
    rms_opt = RMSPropOptimizer(stepsize, decay=gamma)
    univariate_funcs = [np.sin, lambda x: np.exp(x / 10.0), lambda x: x**2]
    grad_uni_fns = [np.cos, lambda x: np.exp(x / 10.0) / 10.0, lambda x: 2 * x]
    for gradf, f in zip(grad_uni_fns, univariate_funcs):
        rms_opt.reset()
        x_onestep = rms_opt.step(f, x_start)
        past_grads = (1 - gamma) * gradf(x_start) * gradf(x_start)
        adapt_stepsize = stepsize / np.sqrt(past_grads + 1e-8)
        x_onestep_target = x_start - gradf(x_start) * adapt_stepsize
        assert np.allclose(x_onestep, x_onestep_target, atol=tol)
        x_twosteps = rms_opt.step(f, x_onestep)
        past_grads = (1 - gamma) * gamma * gradf(x_start) * gradf(x_start) + (
            1 - gamma
        ) * gradf(x_onestep) * gradf(x_onestep)
        adapt_stepsize = stepsize / np.sqrt(past_grads + 1e-8)
        x_twosteps_target = x_onestep - gradf(x_onestep) * adapt_stepsize
        assert np.allclose(x_twosteps, x_twosteps_target, atol=tol)