class_docstr: Tests of the automatic gradient method for CV circuits.
class_docstr_tok: ["Tests","of","the","automatic","gradient","method","for","CV","circuits","."]
docstr: Tests that qnodes can compute the correct gradient when the same parameter is used in multiple gates.
docstr_tok: ["Tests","that","qnodes","can","compute","the","correct","gradient","when","the","same","parameter","is","used","in","multiple","gates","."]
code: def test_cv_gradient_fanout(self, gaussian_dev, tol):
      "Tests that qnodes can compute the correct gradient when the same parameter is used in multiple gates."
      par = anp.array([0.5, 1.3], requires_grad=True)
  
      def circuit(x, y):
          qml.Displacement(x, 0, wires=[0])
          qml.Rotation(y, wires=[0])
          qml.Displacement(0, x, wires=[0])
          return qml.expval(qml.QuadX(0))
  
      q = qml.QNode(circuit, gaussian_dev)
      q(*par)
      grad_F = qml.gradients.finite_diff(q)(*par)
      grad_A = qml.gradients.param_shift_cv(q, dev=gaussian_dev)(*par)
      grad_A2 = qml.gradients.param_shift_cv(
          q, dev=gaussian_dev, force_order2=True
      )(*par)
  
      # the different methods agree
      assert qml.math.allclose(grad_A, grad_F, atol=tol, rtol=0)
      assert qml.math.allclose(grad_A2, grad_F, atol=tol, rtol=0)
  
imports: import pytest
  import autograd
  import numpy
  import pennylane.numpy
  import pennylane
label_desc: Use image node_id 10 for calling the TestCVGradient obj's underlying member method code with example usage: obj.test_cv_gradient_fanout(gaussian_dev, tol) and returns: qml