class_docstr: Tests that ensure various qubit circuits integrate correctly
class_docstr_tok: ["Tests","that","ensure","various","qubit","circuits","integrate","correctly"]
docstr: Test that the gradient of chained QNodes works without error
docstr_tok: ["Test","that","the","gradient","of","chained","QNodes","works","without","error"]
code: def test_chained_qnodes(
      self,
      interface,
      dev,
      diff_method,
      grad_on_execution,
      device_vjp,
  ):
      """Test that the gradient of chained QNodes works without error"""
  
      @qnode(
          dev,
          interface=interface,
          diff_method=diff_method,
          grad_on_execution=grad_on_execution,
          device_vjp=device_vjp,
      )
      def circuit1(weights):
          qml.templates.StronglyEntanglingLayers(weights, wires=[0, 1])
          return qml.expval(qml.PauliZ(0)), qml.expval(qml.PauliZ(1))
  
      @qnode(
          dev,
          interface=interface,
          diff_method=diff_method,
          grad_on_execution=grad_on_execution,
      )
      def circuit2(data, weights):
          data = qml.math.hstack(data)
          qml.templates.AngleEmbedding(data, wires=[0, 1])
          qml.templates.StronglyEntanglingLayers(weights, wires=[0, 1])
          return qml.expval(qml.PauliX(0))
  
      def cost(weights):
          w1, w2 = weights
          c1 = circuit1(w1)
          c2 = circuit2(c1, w2)
          return torch.sum(c2) ** 2
  
      w1 = np.random.random(
          qml.templates.StronglyEntanglingLayers.shape(3, 2)
      )
      w2 = np.random.random(
          qml.templates.StronglyEntanglingLayers.shape(4, 2)
      )
  
      w1 = torch.tensor(w1, requires_grad=True)
      w2 = torch.tensor(w2, requires_grad=True)
  
      weights = [w1, w2]
  
      loss = cost(weights)
      loss.backward()
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane import qnode
  from pennylane.devices import DefaultQubit
label_desc: Use image node_id 3 for calling the TestQubitIntegration obj's underlying member method code with example usage: obj.test_chained_qnodes(interface, dev, diff_method, grad_on_execution, device_vjp) and returns: qml,  qml, qml, unknown