class_docstr: Test the RMSProp (root mean square propagation) optimizer
docstr: Test that the gradient can be applied correctly to a set of parameters
  and that accumulation works correctly.
docstr_tok: ["Test","that","the","gradient","can","be","applied","correctly","to","a","set","of","parameters","and","that","accumulation","works","correctly","."]
code: def test_apply_grad(self, grad, args, tol):
      """
      Test that the gradient can be applied correctly to a set of parameters
      and that accumulation works correctly.
      """
      stepsize, gamma, eps = 0.1, 0.5, 1e-8
      sgd_opt = RMSPropOptimizer(stepsize, decay=gamma, eps=eps)
      grad, args = np.array(grad), np.array(args, requires_grad=True)
  
      a1 = (1 - gamma) * grad**2
      expected = args - stepsize / np.sqrt(a1 + eps) * grad
      res = sgd_opt.apply_grad(grad, args)
      assert np.allclose(res, expected, atol=tol)
  
      # Simulate a new step
      grad = grad + args
      args = expected
  
      a2 = gamma * a1 + (1 - gamma) * grad**2
      expected = args - stepsize / np.sqrt(a2 + eps) * grad
      res = sgd_opt.apply_grad(grad, args)
      assert np.allclose(res, expected, atol=tol)
  
imports: import pytest
  from pennylane import numpy
  from pennylane.optimize import RMSPropOptimizer
label_desc: Use image node_id 1 for calling the TestRMSPropOptimizer obj's underlying member method code with example usage: obj.test_apply_grad(grad, args, tol) without return types