class_docstr: Test for adjoint_vjp
docstr: Test that inhomogenous cotangents give the correct VJP
docstr_tok: ["Test","that","inhomogenous","cotangents","give","the","correct","VJP"]
code: def test_inhomogenous_cotangents(self, cotangents, tol):
      """Test that inhomogenous cotangents give the correct VJP"""
      x = np.array(0.654)
      y = np.array(1.221)
  
      obs = [
          qml.expval(qml.PauliZ(wires=[0])),
          qml.expval(qml.PauliY(wires=[1])),
          qml.expval(qml.PauliX(wires=[0])),
      ]
      qs = QuantumScript(
          [qml.RY(x, wires=[0]), qml.RX(y, wires=[1])],
          obs,
          trainable_params=[0, 1],
      )
  
      actual = adjoint_vjp(qs, cotangents)
      assert isinstance(actual, tuple)
      assert len(actual) == 2
  
      new_cotangents = []
      inner_shape = len(cotangents[0])
      for c in cotangents:
          if isinstance(c, float):
              new_cotangents.append(np.zeros(inner_shape))
          else:
              new_cotangents.append(c)
  
      jac = np.array([[-np.sin(x), 0], [0, -np.cos(y)], [np.cos(x), 0]])
      expected = jac.T @ np.array(new_cotangents)
      assert np.allclose(actual, expected, atol=tol)
  
imports: import pytest
  import pennylane
  from pennylane.devices.qubit import adjoint_jacobian, adjoint_jvp, adjoint_vjp
  from pennylane.tape import QuantumScript
  import pennylane.numpy
label_desc: Use image node_id 10 for calling the TestAdjointVJP obj's underlying member method code with example usage: obj.test_inhomogenous_cotangents(cotangents, tol) without return types