class_docstr: Tests that the template defines the correct decomposition.
class_docstr_tok: ["Tests","that","the","template","defines","the","correct","decomposition","."]
docstr: Test that the GateFabric template with multiple layers works correctly asserting the prepared state.
docstr_tok: ["Test","that","the","GateFabric","template","with","multiple","layers","works","correctly","asserting","the","prepared","state","."]
code: def test_layers_gate_fabric(self, num_qubits, layers, exp_state, tol):
      """Test that the GateFabric template with multiple layers works correctly asserting the prepared state."""
  
      wires = range(num_qubits)
  
      shape = qml.GateFabric.shape(n_layers=layers, n_wires=num_qubits)
      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.GateFabric(
              weight, wires, init_state=init_state, include_pi=True
          )
          return qml.state()
  
      assert qml.math.allclose(circuit(weight), exp_state, atol=tol)
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 3 for calling the TestDecomposition obj's underlying member method code with example usage: obj.test_layers_gate_fabric(num_qubits, layers, exp_state, tol) and returns: qml