Hi, I was working with the qml.UCCSD to construct an ansazt for VQE, and I have a little problem.

The above code give me the following error “DeviceError: Operation BasisState cannot be used after other Operations have already been applied on a default.qubit.autograd device.”

```
import pennylane as qml
from pennylane import numpy as np
dev = qml.device('default.qubit', wires=8)
@qml.qnode(dev)
def circuit2(x):
singles, doubles = qml.qchem.excitations(1, 4)
singles, doubles = qml.qchem.excitations_to_wires(singles, doubles)
qml.UCCSD(weights= x, wires=[0,1,2,3], s_wires=singles, d_wires=doubles, init_state=[1,1,0,0])
qml.UCCSD(weights= x, wires=[4,5,6,7], s_wires=singles, d_wires=doubles, init_state=[1,1,0,0])
return qml.expval(qml.PauliZ(wires=[0]))
theta_optimizer = qml.GradientDescentOptimizer(stepsize=0.3)
theta = np.array([0])
energy = [circuit2(theta)]
theta_evol = [theta]
for _ in range(100):
theta.requires_grad = True
theta = theta_optimizer.step(circuit2, theta)
energy.append(circuit2(theta))
theta_evol.append(theta)
prev_energy = energy[len(energy)-2]
conv = np.abs(energy[-1] - prev_energy)
if conv <= 1e-6:
break
```

My idea was to introduce the repetition of the UCCSD “gate”, apply it k times, but I got that error and when I try to not consider the init_state variable of UCCSD that give me another error (“ValueError: Elements of ‘init_state’ must be integers; got object”). So, i dont know if I am missing something or it’s only possible to use it one time.

The reason to construct a circuit like that is because I want to create a destructive swap test to implement a naive version of VQD, just for context.

Thank you in advance and have a nice day.