Hi everyone,

I am using Pennylane to run a quantum-classical hybrid structure, the quantum circuit returns a reduced density matrix, the quantum circuit is built by the following code:

```
qml.enable_tape()
n_qubits = 8
dev = qml.device("default.qubit", wires=n_qubits)
@qml.qnode(dev)
def qnode(inputs, weights):
qml.templates.AmplitudeEmbedding(features=inputs, wires=range(n_qubits), normalize=False)
for i in range(n_qubits):
qml.Hadamard(wires=i)
qml.templates.BasicEntanglerLayers(weights, wires=range(n_qubits), rotation=qml.RY)
return qml.density_matrix(wires=range(N_encode))
```

Then I transfer qnode to a PyTorch layer by:

```
qlayer = qml.qnn.TorchLayer(qnode, weight_shapes)
```

The output of qlayer is a density matrix, the matrix elements are flatterned and sent to a PyTorch Linear layer. After the network is built, the backward() raises an error:

```
RuntimeError: The jacobian method does not support circuits that return the state
```

Can anyone help me?