I try to run Demo Trainable Quantum Convolution.ipynb offered from here in my google colab evironment.
There are two bugs in this workflow
①I get the following error when executing the third block
AttributeError Traceback (most recent call last)
in
2
3 qonv = QonvLayer(circuit_layers=1, n_rotations=8, out_channels=4, stride=2)
----> 4 qonv.draw()
5 x = torch.rand(size=(1,28,28,1))
6
in draw(self)
35 # build circuit by sending dummy data through it
36 _ = self.circuit(inputs=torch.from_numpy(np.zeros(4)))
—> 37 print(self.circuit.qnode.draw())
38 self.circuit.zero_grad()
39
AttributeError: ‘QNode’ object has no attribute ‘draw’
②I get the following error when executing the 8th block
AttributeError Traceback (most recent call last)
in
16
17 # start training
—> 18 model, losses, accs = train(model, train_loader, epochs=1)
19
20
1 frames
in train(model, train_loader, epochs)
45
46 if i % 5 == 0:
—> 47 model[0].draw()
48
49 print("---------------------------------------\n")
in draw(self)
35 # build circuit by sending dummy data through it
36 _ = self.circuit(inputs=torch.from_numpy(np.zeros(4)))
—> 37 print(self.circuit.qnode.draw())
38 self.circuit.zero_grad()
39
AttributeError: ‘QNode’ object has no attribute ‘draw’
Both errors show ‘QNode’ object has no attribute 'draw
.
I would like to know how to solve this problem.