class_docstr: Tests for the SPSA gradient transform
class_docstr_tok: ["Tests","for","the","SPSA","gradient","transform"]
docstr: Test that the transform works correctly when the diff method for every parameter is
  identified to be 0, and that no tapes were generated.
docstr_tok: ["Test","that","the","transform","works","correctly","when","the","diff","method","for","every","parameter","is","identified","to","be","0",",","and","that","no","tapes","were","generated","."]
code: def test_all_zero_diff_methods_multiple_returns(self):
      """Test that the transform works correctly when the diff method for every parameter is
      identified to be 0, and that no tapes were generated."""
      rng = np.random.default_rng(42)
  
      dev = qml.device(
          "default.qubit", wires=4, shots=many_shots_shot_vector
      )
  
      @qml.qnode(dev)
      def circuit(params):
          qml.Rot(*params, wires=0)
          return qml.expval(qml.PauliZ(wires=2)), qml.probs([2, 3])
  
      params = np.array([0.5, 0.5, 0.5], requires_grad=True)
  
      grad_fn = spsa_grad(circuit, h=h_val, sampler_rng=rng)
      all_result = grad_fn(params)
  
      assert len(all_result) == len(default_shot_vector)
  
      for result in all_result:
          assert isinstance(result, tuple)
  
          assert len(result) == 2
  
          # First elem
          assert len(result[0]) == 3
  
          assert isinstance(result[0][0], numpy.ndarray)
          assert result[0][0].shape == ()
          assert np.allclose(result[0][0], 0)
  
          assert isinstance(result[0][1], numpy.ndarray)
          assert result[0][1].shape == ()
          assert np.allclose(result[0][1], 0)
  
          assert isinstance(result[0][2], numpy.ndarray)
          assert result[0][2].shape == ()
          assert np.allclose(result[0][2], 0)
  
          # Second elem
          assert len(result[0]) == 3
  
          assert isinstance(result[1][0], numpy.ndarray)
          assert result[1][0].shape == (4,)
          assert np.allclose(result[1][0], 0)
  
          assert isinstance(result[1][1], numpy.ndarray)
          assert result[1][1].shape == (4,)
          assert np.allclose(result[1][1], 0)
  
          assert isinstance(result[1][2], numpy.ndarray)
          assert result[1][2].shape == (4,)
          assert np.allclose(result[1][2], 0)
  
imports: import numpy
  import pytest
  from pennylane import numpy
  import pennylane
  from pennylane.gradients import spsa_grad
  from pennylane.devices import DefaultQubitLegacy
  from pennylane.measurements import Shots
  from pennylane.operation import Observable, AnyWires
label_desc: Use image node_id 10 for calling the TestSpsaGradient obj's underlying member method code with example usage: obj.test_all_zero_diff_methods_multiple_returns() and returns: qml,  qml