Hi,
I’m trying to pass a list of wires that I want my QNode to operate on to my default QNode. I’ve been trying to do a couple things:
- print out the values that I’m passing in to make sure that I’m passing in the correct values
- get the values to be recognized in the QNode to define my operations
my code flows something like the following:
dev = qml.device('default.qubit', wires=4)
@qml.qnode(dev, interface='torch')
def QCircuit(wire):
#I can't assign the wire values; it just won't let me do it, even when
my defined values are integers
qml.RX(1., wires=wire[0])
qml.RY(2., wires=wire[1])
qml.RZ(3., wires=wire[2])
qml.RX(4., wires=wire[3])
#This is a test to see if I can print out the value- I fail at doing this
test=wire[0]
print(test)
#print(Variable(test).data.numpy())
return qml.expval(qml.PauliZ(0))
class QuantumCircuitTest(torch.nn.Module):
def __init__(self, input):
super(QuantumCircuitTest, self).__init__()
self.wire = [0,1,2,3]
def forward(self, input):
return QCircuit(self.wire)
Printing the above value doesn’t give me anything hopeful at most I get
‘Variable 10: name = None,’
Furthermore I get thrown an error when I try to do ‘wires=wire[0]’
Any ideas or suggestions? At this point I’m stuck.