Closed antalszava closed 4 years ago
I think we should be able to fix this issue, #456, and #423 at the same time. I'm thinking a single bookkeeping Wires
or WireMap
class (name provisional) which is responsible for all this, and which is called by all other parts of the software as needed
Maybe this should be an ADR though. I think it should be done at the level of the device, i.e. like
dev = qml.device("qiskit.aer", wires=[3,4,5,6,7])
We can just overload the wires argument in the following way
if isinstance(wires, Sequence):
wires = list(wires)
elsif isinstance(wires, numbers.Integral):
wires = range(wires)
num_wires = len(wires)
I don't even think we have to change so much in the rest of the code. Only the device itself will have some kind of WireMap
that maps the wires given to the physical qubits that are available.
dev = qml.device("qiskit.aer", wires=[3,4,5,6,7])
I agree! This is what I have been envisioning as well. Simpler for the user (in that they don't need to learn a new object/new methods), and fits the existing paradigm really well.
@antalszava, Qiskit version 0.16.2 was released on March 21st. Is this bug now closed?
Yes :crying_cat_face:
Qiskit versions (pip install qiskit
):
qiskit==0.16.2
qiskit-aer==0.4.1
qiskit-aqua==0.6.5
qiskit-ibmq-provider==0.5.0
qiskit-ignis==0.2.0
qiskit-terra==0.12.0
After that, had to pip install python-constraint
(due an error from qiskit-terra
) and then received the original error.
Still relevant with
qiskit==0.18.0
qiskit-aer==0.5.0
qiskit-aqua==0.6.5
qiskit-ibmq-provider==0.6.0
qiskit-ignis==0.3.0
qiskit-terra==0.13.0
Issue description
No problem with using
RandomLayers
with the Qiskit plugin.As
RandomLayers
usesnumpy
specific functions to generatewires
,numpy
native integers are returned aswires
instead of values of typeint
. This results in a Qiskit error when using devices from the Qiskit plugin as per the following known bug and open issue: https://github.com/Qiskit/qiskit-terra/issues/3929Each time
RandomLayers
is used with the Qiskit plugin.Source code and tracebacks
Code to reproduce this problem:
Traceback:
Note: a quick fix is available on the
wires_to_int
branch.Additional information
Things to consider:
wires
.Fruit for thought in the long run: it could be a good idea in general, to place a sort of "wire type" modifying logic in PennyLane, such that "from a given point" in the line of execution, it would be guaranteed, that all
wires
are of typeint
under the hood.This would allow:
wires
to take place only at one place in the entire codebaseRandomLayers
) to not need to contain logic on conversion, checking validity, etc.