Hello! If applicable, put your complete code example down below. Make sure that your code:
- is 100% self-contained — someone can copy-paste exactly what is here and run it to
reproduce the behaviour you are observing - includes comments
I am just converting a Pennylane circuit to QASM language using this line of code: dev._circuit.qasm(formatted=True,filename=filename). When trying to run the same file, I am getting the error listed below.
def eval(self, images, labels):
counter=0
for label,image in zip(labels, images):
self.circuit(self,self.weights,image)
filename='C:/Users/gandhi.ha/code/AMP/image_0=' + str(counter) +'_'+ str(0) + '.qasm'
cirs = dev._circuit.qasm(formatted=True,filename=filename)
np.save('C:/Users/gandhi.ha/code/AMP/label_0=' + str(counter) + '_'+ str(0) +'.npy',label)
counter+=1
return
from qiskit import execute
from qiskit import Aer
qasm_list = []
qasm_file =glob.glob('C:/Users/gandhi.ha/code/AMP/*_0.qasm',recursive= True) #C:\Users\gandhi.ha\code\AMP
for file in qasm_file :
q=QuantumCircuit.from_qasm_file(file)
qasm_list.append(q)
Q= QuantumCircuit.depth(q)
IBMQ.save_account('your IBM token', overwrite = True)
IBMQ.load_account()
provider = IBMQ.get_provider(hub ='ibm-q', group = 'open' ,project ='main')
job=execute(qasm_list,provider.get_backend('ibmq_qasm_simulator'),shots=1000)
result=job.result().get_counts()
probs_list=[]
count_3=0
for i in result:
np.save('C:/Users/gandhi.ha/code/PROBS_AMP/data_0='+str(count_3)+'_'+str(0)+'.npy',i)
count_3+=1
If you want help with diagnosing an error, please put the full error message below:
"Duplicate declaration for gate 'multiplex1_reverse_dg' at line 7, file C:/Users/gandhi.ha/code/AMP\\image_0=0_0.qasm.\nPrevious occurrence at line 4, file C:/Users/gandhi.ha/code/AMP\\image_0=0_0.qasm"```
And, finally, make sure to include the versions of your packages. Specifically, show us the output of `qml.about()`.
Name: PennyLane
Version: 0.30.0
Summary: PennyLane is a Python quantum machine learning library by Xanadu Inc.
Home-page: https://github.com/XanaduAI/pennylane
Author:
Author-email:
License: Apache License 2.0
Location: c:\users\gandhi.ha\appdata\local\programs\python\python310\lib\site-packages
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, pennylane-lightning, requests, rustworkx, scipy, semantic-version, toml
Required-by: PennyLane-Lightning, PennyLane-qiskit
Platform info: Windows-10-10.0.19045-SP0
Python version: 3.10.5
Numpy version: 1.23.1
Scipy version: 1.9.0
Installed devices:
- default.gaussian (PennyLane-0.30.0)
- default.mixed (PennyLane-0.30.0)
- default.qubit (PennyLane-0.30.0)
- default.qubit.autograd (PennyLane-0.30.0)
- default.qubit.jax (PennyLane-0.30.0)
- default.qubit.tf (PennyLane-0.30.0)
- default.qubit.torch (PennyLane-0.30.0)
- default.qutrit (PennyLane-0.30.0)
- null.qubit (PennyLane-0.30.0)
- lightning.qubit (PennyLane-Lightning-0.30.0)
- qiskit.aer (PennyLane-qiskit-0.28.0)
- qiskit.basicaer (PennyLane-qiskit-0.28.0)
- qiskit.ibmq (PennyLane-qiskit-0.28.0)
- qiskit.ibmq.circuit_runner (PennyLane-qiskit-0.28.0)
- qiskit.ibmq.sampler (PennyLane-qiskit-0.28.0)