class_docstr: Tests for adjoint_jacobian
class_docstr_tok: ["Tests","for","adjoint_jacobian"]
docstr: Tests that the gradient of multiple RX gates in a circuit yields the correct result.
code: def test_multiple_rx_gradient(self, tol):
      """Tests that the gradient of multiple RX gates in a circuit yields the correct result."""
      params = np.array([np.pi, np.pi / 2, np.pi / 3])
  
      qs = QuantumScript(
          [
              qml.RX(params[0], wires=0),
              qml.RX(params[1], wires=1),
              qml.RX(params[2], wires=2),
          ],
          [qml.expval(qml.PauliZ(idx)) for idx in range(3)],
      )
      qs_valid, _ = qml.devices.preprocess.decompose(qs, adjoint_ops)
      qs_valid = qs_valid[0]
  
      # circuit jacobians
      jacobian = adjoint_jacobian(qs_valid)
      expected_jacobian = -np.diag(np.sin(params))
      assert np.allclose(jacobian, expected_jacobian, atol=tol, rtol=0)
      assert isinstance(jacobian, tuple)
      assert all(isinstance(j, tuple) for j in jacobian)
  
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 5 for calling the TestAdjointJacobian obj's underlying member method code with example usage: obj.test_multiple_rx_gradient(tol) without return types