class_docstr: Tests for the Local Hilbert-Schmidt template.
docstr: Test that the local hilbert schmidt template can be used inside a qnode.
docstr_tok: ["Test","that","the","local","hilbert","schmidt","template","can","be","used","inside","a","qnode","."]
code: def test_qnode_integration(self):
      """Test that the local hilbert schmidt template can be used inside a qnode."""
  
      u_tape = qml.tape.QuantumTape([qml.CZ(wires=(0, 1))])
  
      def v_function(params):
          qml.RZ(params[0], wires=2)
          qml.RZ(params[1], wires=3)
          qml.CNOT(wires=[2, 3])
          qml.RZ(params[2], wires=3)
          qml.CNOT(wires=[2, 3])
  
      dev = qml.device("default.qubit", wires=4)
  
      @qml.qnode(dev)
      def local_hilbert_test(v_params, v_function, v_wires, u_tape):
          qml.LocalHilbertSchmidt(
              v_params,
              v_function=v_function,
              v_wires=v_wires,
              u_tape=u_tape,
          )
          return qml.probs(u_tape.wires + v_wires)
  
      # pylint: disable=unsubscriptable-object
      def cost_lhst(parameters, v_function, v_wires, u_tape):
          return (
              1
              - local_hilbert_test(
                  v_params=parameters,
                  v_function=v_function,
                  v_wires=v_wires,
                  u_tape=u_tape,
              )[0]
          )
  
      res = cost_lhst(
          [
              3 * qml.numpy.pi / 2,
              3 * qml.numpy.pi / 2,
              qml.numpy.pi / 2,
          ],
          v_function=v_function,
          v_wires=[2, 3],
          u_tape=u_tape,
      )
  
      assert qml.math.allclose(res, 0.5)
  
imports: import pytest
  import pennylane
label_desc: Use image node_id 4 for calling the TestLocalHilbertSchmidt obj's underlying member method code with example usage: obj.test_qnode_integration() and returns: qml, unknown