class_docstr: Tests for the ``adjoint_jacobian`` method
class_docstr_tok: ["Tests","for","the","``","adjoint_jacobian","``","method"]
docstr: Tests that the gradient of multiple RX gates in a circuit yields the correct result.
docstr_tok: ["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."""
      dev = qml.device("default.qubit.legacy", wires=3)
      params = np.array([np.pi, np.pi / 2, np.pi / 3])
  
      with qml.queuing.AnnotatedQueue() as q:
          qml.RX(params[0], wires=0)
          qml.RX(params[1], wires=1)
          qml.RX(params[2], wires=2)
  
          for idx in range(3):
              qml.expval(qml.PauliZ(idx))
  
      tape = qml.tape.QuantumScript.from_queue(q)
      # circuit jacobians
      dev_jacobian = dev.adjoint_jacobian(tape)
      assert isinstance(dev_jacobian, tuple)
      assert len(dev_jacobian) == 3
      assert all(
          isinstance(jac, tuple) and len(jac) == 3
          for jac in dev_jacobian
      )
      assert all(
          all(isinstance(j, np.ndarray) for j in jac)
          for jac in dev_jacobian
      )
  
      expected_jacobian = -np.diag(np.sin(params))
      assert np.allclose(
          dev_jacobian, expected_jacobian, atol=tol, rtol=0
      )
  
imports: import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 11 for calling the TestAdjointJacobian obj's underlying member method code with example usage: obj.test_multiple_rx_gradient(tol) without return types