class_docstr: Tests for the Interferometer from the pennylane.template.layers module.
class_docstr_tok: ["Tests","for","the","Interferometer","from","the","pennylane.template.layers","module","."]
docstr: test integration with PennyLane and gradient calculations
docstr_tok: ["test","integration","with","PennyLane","and","gradient","calculations"]
code: def test_integration(self, tol):
      """test integration with PennyLane and gradient calculations"""
      N = 4
      wires = range(N)
      dev = qml.device("default.gaussian", wires=N)
  
      sq = np.array(
          [
              [0.8734294, 0.96854066],
              [0.86919454, 0.53085569],
              [0.23272833, 0.0113988],
              [0.43046882, 0.40235136],
          ]
      )
  
      theta = np.array(
          [
              3.28406182,
              3.0058243,
              3.48940764,
              3.41419504,
              4.7808479,
              4.47598146,
          ]
      )
      phi = np.array(
          [
              3.89357744,
              2.67721355,
              1.81631197,
              6.11891294,
              2.09716418,
              1.37476761,
          ]
      )
      varphi = np.array([0.4134863, 6.17555778, 0.80334114, 2.02400747])
  
      @qml.qnode(dev)
      def circuit(theta, phi, varphi):
          for w in wires:
              qml.Squeezing(sq[w][0], sq[w][1], wires=w)
  
          qml.Interferometer(
              theta=theta, phi=phi, varphi=varphi, wires=wires
          )
          return qml.expval(qml.NumberOperator(0))
  
      res = circuit(theta, phi, varphi)
      expected = np.array(0.96852694)
      assert np.allclose(res, expected, atol=tol)
  
file_path: pennylane/tests/templates/test_subroutines/test_interferometer.py
imports: import pytest
  import numpy
  import pennylane
  from pennylane.wires import Wires
label_desc: Use image node_id 10 for calling the TestInterferometer obj's underlying member method code with example usage: obj.test_integration(tol) and returns: qml