class_docstr: Tests of the automatic gradient method for CV circuits.
class_docstr_tok: ["Tests","of","the","automatic","gradient","method","for","CV","circuits","."]
docstr: An integration test for InterferometerUnitary, a gate that supports analytic
  differentiation if succeeding the gate to be differentiated, but cannot be
  differentiated itself.
  
  This ensures that, assuming the _heisenberg_rep is defined, the quantum
  gradient analytic method can still be used, and returns the correct result.
docstr_tok: ["An","integration","test","for","InterferometerUnitary",",","a","gate","that","supports","analytic","differentiation","if","succeeding","the","gate","to","be","differentiated",",","but","can","not","be","differentiated","itself",".","This","ensures","that",",","assuming","the","_heisenberg_rep","is","defined",",","the","quantum","gradient","analytic","method","can","still","be","used",",","and","returns","the","correct","result","."]
code: def test_CVOperation_with_heisenberg_and_no_params(
      self, gaussian_dev, tol
  ):
      """An integration test for InterferometerUnitary, a gate that supports analytic
      differentiation if succeeding the gate to be differentiated, but cannot be
      differentiated itself.
  
      This ensures that, assuming the _heisenberg_rep is defined, the quantum
      gradient analytic method can still be used, and returns the correct result.
      """
  
      x = anp.array(0.5, requires_grad=True)
  
      U = np.array(
          [
              [0.51310276 + 0.81702166j, 0.13649626 + 0.22487759j],
              [0.26300233 + 0.00556194j, -0.96414101 - 0.03508489j],
          ]
      )
  
      def circuit(x):
          qml.Displacement(x, 0, wires=0)
          qml.InterferometerUnitary(U, wires=[0, 1])
          return qml.expval(qml.QuadX(0))
  
      qnode = qml.QNode(circuit, gaussian_dev)
      qnode(x)
      grad_F = qml.gradients.finite_diff(qnode)(x)
      grad_A = qml.gradients.param_shift_cv(qnode, dev=gaussian_dev)(x)
      grad_A2 = qml.gradients.param_shift_cv(
          qnode, dev=gaussian_dev, force_order2=True
      )(x)
  
      # the different methods agree
      assert (
          qml.math.shape(grad_A)
          == qml.math.shape(grad_A2)
          == qml.math.shape(grad_F)
          == ()
      )
      assert np.allclose(grad_A, grad_F, atol=tol)
      assert np.allclose(grad_A2, grad_F, atol=tol)
  
imports: import pytest
  import autograd
  import numpy
  import pennylane.numpy
  import pennylane
label_desc: Use image node_id 11 for calling the TestCVGradient obj's underlying member method code with example usage: obj.test_CVOperation_with_heisenberg_and_no_params(gaussian_dev, tol) and returns: qml