class_docstr: Tests for the probs function
class_docstr_tok: ["Tests","for","the","probs","function"]
docstr: Test that the finite difference and parameter shift rule
  provide the same Jacobian.
docstr_tok: ["Test","that","the","finite","difference","and","parameter","shift","rule","provide","the","same","Jacobian","."]
code: def test_numerical_analytic_diff_agree(self, tol, mocker):
      """Test that the finite difference and parameter shift rule
      provide the same Jacobian."""
      w = 4
      dev = qml.device("default.qubit.legacy", wires=w)
      spy = mocker.spy(qml.QubitDevice, "probability")
  
      def circuit(x, y, z):
          for i in range(w):
              qml.RX(x, wires=i)
              qml.PhaseShift(z, wires=i)
              qml.RY(y, wires=i)
  
          qml.CNOT(wires=[0, 1])
          qml.CNOT(wires=[1, 2])
          qml.CNOT(wires=[2, 3])
  
          return qml.probs(wires=[1, 3])
  
      params = pnp.array([0.543, -0.765, -0.3], requires_grad=True)
  
      circuit_F = qml.QNode(circuit, dev, diff_method="finite-diff")
      circuit_A = qml.QNode(circuit, dev, diff_method="parameter-shift")
      res_F = qml.jacobian(circuit_F)(*params)
      res_A = qml.jacobian(circuit_A)(*params)
  
      # Both jacobians should be of shape (2**prob.wires, num_params)
      assert isinstance(res_F, tuple) and len(res_F) == 3
      assert all(_r.shape == (2**2,) for _r in res_F)
      assert isinstance(res_A, tuple) and len(res_A) == 3
      assert all(_r.shape == (2**2,) for _r in res_A)
  
      # Check that they agree up to numeric tolerance
      assert all(
          np.allclose(_rF, _rA, atol=tol, rtol=0)
          for _rF, _rA in zip(res_F, res_A)
      )
  
      custom_measurement_process(dev, spy)
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.measurements import ProbabilityMP, Shots
  from pennylane.devices.qubit.measure import flatten_state
label_desc: Use image node_id 13 for calling the TestProbs obj's underlying member method code with example usage: obj.test_numerical_analytic_diff_agree(tol, mocker) and returns: qml