You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/Users/liup/quantum/qiskit_dec_2017/qiskit/tools/sympy_executor/sympy_executor.py", line 106, in
qcheckermain(args)
File "/Users/liup/quantum/qiskit_dec_2017/qiskit/tools/sympy_executor/sympy_executor.py", line 88, in qcheckermain
unrolled_circuit.execute()
File "/Users/liup/quantum/qiskit_dec_2017/qiskit/unroll/_unroller.py", line 279, in execute
self._process_node(self.ast)
File "/Users/liup/quantum/qiskit_dec_2017/qiskit/unroll/_unroller.py", line 187, in _process_node
self._process_children(node)
File "/Users/liup/quantum/qiskit_dec_2017/qiskit/unroll/_unroller.py", line 182, in _process_children
self._process_node(kid)
File "/Users/liup/quantum/qiskit_dec_2017/qiskit/unroll/_unroller.py", line 222, in _process_node
self._process_custom_unitary(node)
File "/Users/liup/quantum/qiskit_dec_2017/qiskit/unroll/_unroller.py", line 111, in _process_custom_unitary
self.arg_stack[0:-1])
File "/Users/liup/quantum/qiskit_dec_2017/qiskit/unroll/_dagbackend.py", line 196, in start_gate
args)), condition)
File "/Users/liup/quantum/qiskit_dec_2017/qiskit/unroll/_dagbackend.py", line 195, in
name, qubits, [], list(map(lambda x: x.sym(nested_scope),
AttributeError: 'Prefix' object has no attribute 'sym'
Problem:
The problem lies in unroll/_dagbackend.py (line 195).
Not all node objects have the sym method.
Fix:
Changing x.sym(...) to x.real(...) solvesthe problem.
Further discussion:
I understand that you may want to keep the symbolic form in the circuit graph. But it is too aggressive to keep only the symbolic form.
Ideally, we should keep both the symbolic form and the floating point form so that it is always possible to fail back to the floating point form whenever the symbolic form is too complex to work with. (as a side note, this reminds me of the concolic execution technique, in which we keep both the symbolic variable and the concrete value of it.)
The text was updated successfully, but these errors were encountered:
the crash-inducing input is: https://github.com/QISKit/openqasm/blob/master/examples/ibmqx2/qe_qft_4.qasm
the code snippet:
from qiskit import qasm, unroll
basis_gates = "id,x,y,z,h,s,sdg,cx,t,tdg,u1,u2,u3,cy,cz,ccx,cu1,cu3".split(",")
ast = qasm.Qasm(filename=qasm_file).parse() # Node (AST)
unrolled_circuit = unroll.Unroller(ast=ast, backend=unroll.DAGBackend(basis_gates))
unrolled_circuit.execute()
circuit_unrolled = unrolled_circuit.backend.circuit # circuit DAG
The crash stack trace:
Traceback (most recent call last):
File "/Users/liup/quantum/qiskit_dec_2017/qiskit/tools/sympy_executor/sympy_executor.py", line 106, in
qcheckermain(args)
File "/Users/liup/quantum/qiskit_dec_2017/qiskit/tools/sympy_executor/sympy_executor.py", line 88, in qcheckermain
unrolled_circuit.execute()
File "/Users/liup/quantum/qiskit_dec_2017/qiskit/unroll/_unroller.py", line 279, in execute
self._process_node(self.ast)
File "/Users/liup/quantum/qiskit_dec_2017/qiskit/unroll/_unroller.py", line 187, in _process_node
self._process_children(node)
File "/Users/liup/quantum/qiskit_dec_2017/qiskit/unroll/_unroller.py", line 182, in _process_children
self._process_node(kid)
File "/Users/liup/quantum/qiskit_dec_2017/qiskit/unroll/_unroller.py", line 222, in _process_node
self._process_custom_unitary(node)
File "/Users/liup/quantum/qiskit_dec_2017/qiskit/unroll/_unroller.py", line 111, in _process_custom_unitary
self.arg_stack[0:-1])
File "/Users/liup/quantum/qiskit_dec_2017/qiskit/unroll/_dagbackend.py", line 196, in start_gate
args)), condition)
File "/Users/liup/quantum/qiskit_dec_2017/qiskit/unroll/_dagbackend.py", line 195, in
name, qubits, [], list(map(lambda x: x.sym(nested_scope),
AttributeError: 'Prefix' object has no attribute 'sym'
Problem:
The problem lies in unroll/_dagbackend.py (line 195).
Not all node objects have the sym method.
Fix:
Changing x.sym(...) to x.real(...) solvesthe problem.
Further discussion:
I understand that you may want to keep the symbolic form in the circuit graph. But it is too aggressive to keep only the symbolic form.
Ideally, we should keep both the symbolic form and the floating point form so that it is always possible to fail back to the floating point form whenever the symbolic form is too complex to work with. (as a side note, this reminds me of the concolic execution technique, in which we keep both the symbolic variable and the concrete value of it.)
The text was updated successfully, but these errors were encountered: