class_docstr: Test that the template defines the correct decomposition.
class_docstr_tok: ["Test","that","the","template","defines","the","correct","decomposition","."]
docstr: Test that the k-UpCCGSD template with multiple layers works correctly asserting the prepared state.
docstr_tok: ["Test","that","the","k-UpCCGSD","template","with","multiple","layers","works","correctly","asserting","the","prepared","state","."]
code: def test_k_layers_upccgsd(self, num_qubits, k, exp_state, tol):
      """Test that the k-UpCCGSD template with multiple layers works correctly asserting the prepared state."""
  
      wires = range(num_qubits)
  
      shape = qml.kUpCCGSD.shape(k=k, n_wires=num_qubits, delta_sz=0)
      weight = np.pi / 2 * qml.math.ones(shape)
  
      dev = qml.device("default.qubit", wires=wires)
  
      init_state = qml.math.array(
          [1 if x < num_qubits // 2 else 0 for x in wires]
      )
  
      @qml.qnode(dev)
      def circuit(weight):
          qml.kUpCCGSD(
              weight,
              wires=wires,
              k=k,
              delta_sz=0,
              init_state=init_state,
          )
          return qml.state()
  
      res = circuit(weight)
  
      assert qml.math.allclose(res, exp_state, atol=tol)
  
imports: import pytest
  import numpy
  import pennylane
label_desc: Use image node_id 3 for calling the TestDecomposition obj's underlying member method code with example usage: obj.test_k_layers_upccgsd(num_qubits, k, exp_state, tol) and returns: qml