class_docstr: Test working cases of stoch_pulse_grad.
class_docstr_tok: ["Test","working","cases","of","stoch_pulse_grad","."]
docstr: Test that a zero gradient is returned when all trainable parameters are
  identified to have zero gradient in advance.
docstr_tok: ["Test","that","a","zero","gradient","is","returned","when","all","trainable","parameters","are","identified","to","have","zero","gradient","in","advance","."]
code: def test_all_zero_grads(
      self, dev_name, ops, arg, exp_shapes
  ):  # pylint:disable=unused-argument
      """Test that a zero gradient is returned when all trainable parameters are
      identified to have zero gradient in advance."""
      import jax
      from jax import numpy as jnp
  
      arg = None if arg is None else jnp.array(arg)
      ops = ops(arg)
      measurements = [
          qml.expval(qml.PauliZ("a")),
          qml.probs(["b", "c"]),
      ]
      tape = qml.tape.QuantumScript(ops, measurements=measurements)
      tapes, fn = stoch_pulse_grad(tape)
      assert not tapes
  
      res = fn([])
      assert isinstance(res, tuple) and len(res) == 2
      for r, exp_shape in zip(res, exp_shapes):
          if isinstance(exp_shape, list):
              assert all(
                  qml.math.allclose(_r, np.zeros(_sh))
                  for _r, _sh in zip(r, exp_shape)
              )
          else:
              assert qml.math.allclose(r, np.zeros(exp_shape))
      jax.clear_caches()
  
imports: import warnings
  import copy
  import pytest
  import numpy
  import pennylane
  from pennylane.gradients.general_shift_rules import eigvals_to_frequencies, generate_shift_rule
  from pennylane.gradients.pulse_gradient import _parshift_and_integrate, _split_evol_ops, _split_evol_tape, stoch_pulse_grad
label_desc: Use image node_id 2 for calling the TestStochPulseGrad obj's underlying member method code with example usage: obj.test_all_zero_grads(dev_name, ops, arg, exp_shapes) without return types