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
In lines 288-300 of gate_set_tomography.py, which is this:
forgateingate_set:
ifgateisnotNone:
init_args=signature(gate).parametersif"q"ininit_args:
nqubits=1elif"q0"ininit_argsand"q1"ininit_argsand"q2"notininit_args:
nqubits=2else:
raise_error(
RuntimeError,
f"Gate {gate} is not supported for `GST`, only 1- and 2-qubits gates are supported.",
)
gate=gate(*range(nqubits))
it only extracts which qubits the gate acts on. I've tried to extract the parameters from the gates in gate_set but it always returns something like this `<property object at 0x123456789>, i.e.
.parameters is a property bound to an instance. If you take the class, there is no way you can access parameters
[ins] In [1]: fromqibo.gatesimportRX
[ins] In [2]: g=RX(0, 1.23)
[ins] In [3]: g.parametersOut[3]: (1.23,)
[ins] In [4]: RX.parametersOut[4]: <propertyat0x121d0e160>
[ins] In [5]: g.__class__Out[5]: qibo.gates.gates.RX
I.e. an instance is a container of its state (its attributes). If you take the class, you're extracting some information about the type, but the state is completely lost.
If you are interested in the content of the instance (e.g. the .parameters property, generated from the underlying attributes), you should keep the whole instance, not just its type.
Thanks for the explanation @alecandido, it confirms my suspicions. GST works as is, but only for non-parameterized gates. We'll need to tweak it, by keeping whole instances of the gates, for parameterized gates.
In this current version of gate set tomography, it seems like only non-parameterized gates can be passed into GST.
There are two ways that I generate non-parameterized gates:
or
Then we pass them into
GST
:In lines 288-300 of
gate_set_tomography.py
, which is this:it only extracts which qubits the gate acts on. I've tried to extract the
parameters
from the gates ingate_set
but it always returns something like this `<property object at 0x123456789>, i.e.Looking back at our input for
gate_set
, it turns out that it's difficult to extractparameters
from each of the gates ingate_set
.I realise that if we can extract the parameters from the
target_gates
.Hence, for GST, is there another way of inputting the gates instead of doing
gate_set = [g.__class__ for g in target_gates]
?The text was updated successfully, but these errors were encountered: