class_docstr: Test that stoch_pulse_grad integrates correctly with QNodes and ML interfaces.
class_docstr_tok: ["Test","that","stoch_pulse_grad","integrates","correctly","with","QNodes","and","ML","interfaces","."]
docstr: Test that a simple qnode that returns an probabilities
  can be differentiated with stoch_pulse_grad.
docstr_tok: ["Test","that","a","simple","qnode","that","returns","an","probabilities","can","be","differentiated","with","stoch_pulse_grad","."]
code: def test_simple_qnode_probs_expval(
      self, dev_name, num_split_times, shots, tol
  ):
      """Test that a simple qnode that returns an probabilities
      can be differentiated with stoch_pulse_grad."""
      import jax
      import jax.numpy as jnp
  
      jax.config.update("jax_enable_x64", True)
      key = "prng_key" if dev_name == "default.qubit.jax" else "seed"
      dev = qml.device(
          dev_name,
          wires=1,
          shots=shots,
          **{key: jax.random.PRNGKey(74)},
      )
      T = 0.2
      ham_single_q_const = qml.pulse.constant * qml.PauliY(0)
  
      @qml.qnode(
          dev,
          interface="jax",
          diff_method=stoch_pulse_grad,
          num_split_times=num_split_times,
      )
      def circuit(params):
          qml.evolve(ham_single_q_const)(params, T)
          return qml.probs(wires=0), qml.expval(qml.PauliZ(0))
  
      params = [jnp.array(0.4)]
      jac = jax.jacobian(circuit)(params)
      p = params[0] * T
      exp_jac = (
          jnp.array([-1, 1]) * jnp.sin(2 * p) * T,
          -2 * jnp.sin(2 * p) * T,
      )
      if hasattr(shots, "len"):
          for j_shots, e_shots in zip(jac, exp_jac):
              for j, e in zip(j_shots, e_shots):
                  assert qml.math.allclose(j[0], e, atol=tol, rtol=0.0)
      else:
          for j, e in zip(jac, exp_jac):
              assert qml.math.allclose(j[0], e, atol=tol, rtol=0.0)
      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 4 for calling the TestStochPulseGradIntegration obj's underlying member method code with example usage: obj.test_simple_qnode_probs_expval(dev_name, num_split_times, shots, tol) and returns: qml,  qml