class_docstr: Tests for the ``adjoint_jacobian`` method
class_docstr_tok: ["Tests","for","the","``","adjoint_jacobian","``","method"]
docstr: Tests that gates with multiple free parameters yield correct gradients.
docstr_tok: ["Tests","that","gates","with","multiple","free","parameters","yield","correct","gradients","."]
code: def test_gradient_gate_with_multiple_parameters(self, tol, dev):
      """Tests that gates with multiple free parameters yield correct gradients."""
      x, y, z = [0.5, 0.3, -0.7]
  
      with qml.queuing.AnnotatedQueue() as q:
          qml.RX(0.4, wires=[0])
          qml.Rot(x, y, z, wires=[0])
          qml.RY(-0.2, wires=[0])
          qml.expval(qml.PauliZ(0))
  
      tape = qml.tape.QuantumScript.from_queue(q)
      tape.trainable_params = {1, 2, 3}
  
      grad_D = dev.adjoint_jacobian(tape)
      tapes, fn = qml.gradients.finite_diff(tape)
      grad_F = fn(qml.execute(tapes, dev, None))
  
      # gradient has the correct shape and every element is nonzero
      assert isinstance(grad_D, tuple)
      assert len(grad_D) == 3
      assert all(isinstance(g, np.ndarray) for g in grad_D)
  
      assert np.count_nonzero(grad_D) == 3
      # the different methods agree
      assert np.allclose(grad_D, grad_F, atol=tol, rtol=0)
  
imports: import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 13 for calling the TestAdjointJacobian obj's underlying member method code with example usage: obj.test_gradient_gate_with_multiple_parameters(tol, dev) without return types