class_docstr: Tests for the vjp function
class_docstr_tok: ["Tests","for","the","vjp","function"]
docstr: Tests correct output shape and evaluation for a tape
  with prob and expval outputs
docstr_tok: ["Tests","correct","output","shape","and","evaluation","for","a","tape","with","prob","and","expval","outputs"]
code: def test_prob_expectation_values(self, tol):
      """Tests correct output shape and evaluation for a tape
      with prob and expval outputs"""
      dev = qml.device("default.qubit", wires=2)
      x = 0.543
      y = -0.654
  
      with qml.queuing.AnnotatedQueue() as q:
          qml.RX(x, wires=[0])
          qml.RY(y, wires=[1])
          qml.CNOT(wires=[0, 1])
          qml.expval(qml.PauliZ(0))
          qml.probs(wires=[0, 1])
  
      tape = qml.tape.QuantumScript.from_queue(q)
      tape.trainable_params = {0, 1}
      dy = tuple([np.array(1.0), np.array([2.0, 3.0, 4.0, 5.0])])
  
      tapes, fn = qml.gradients.vjp(tape, dy, param_shift)
      assert len(tapes) == 4
  
      res = fn(dev.execute(tapes))
      assert res.shape == (2,)
  
      exp = (
          np.array(
              [
                  [-2 * np.sin(x), 0],
                  [
                      -(np.cos(y / 2) ** 2 * np.sin(x)),
                      -(np.cos(x / 2) ** 2 * np.sin(y)),
                  ],
                  [
                      -(np.sin(x) * np.sin(y / 2) ** 2),
                      (np.cos(x / 2) ** 2 * np.sin(y)),
                  ],
                  [
                      (np.sin(x) * np.sin(y / 2) ** 2),
                      (np.sin(x / 2) ** 2 * np.sin(y)),
                  ],
                  [
                      (np.cos(y / 2) ** 2 * np.sin(x)),
                      -(np.sin(x / 2) ** 2 * np.sin(y)),
                  ],
              ]
          )
          / 2
      )
      dy = np.array([1.0, 2.0, 3.0, 4.0, 5.0])
      assert np.allclose(res, dy @ exp, atol=tol, rtol=0)
  
imports: from functools import partial
  import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.gradients import param_shift
label_desc: Use image node_id 5 for calling the TestVJP obj's underlying member method code with example usage: obj.test_prob_expectation_values(tol) without return types