-
Notifications
You must be signed in to change notification settings - Fork 603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Selecting wires of default.tensor
at runtime if they are not provided by user
#5744
Selecting wires of default.tensor
at runtime if they are not provided by user
#5744
Conversation
default.tensor
at runtime if they are not provided by user
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5744 +/- ##
==========================================
- Coverage 99.67% 99.66% -0.01%
==========================================
Files 413 413
Lines 39254 38957 -297
==========================================
- Hits 39126 38828 -298
- Misses 128 129 +1 ☔ View full report in Codecov by Sentry. |
…o Selecting_wires_at_runtime_default_tensor
…o Selecting_wires_at_runtime_default_tensor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @PietropaoloFrisoni ! Just a few a comments and questions.
…o Selecting_wires_at_runtime_default_tensor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Pietro!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @PietropaoloFrisoni !
…o Selecting_wires_at_runtime_default_tensor
Context: In the
default.tensor
device, we need to create an initial state (e.g. in the MPS case using theMPS_computational_state function
) inquimb
, which requires the number of qubits to be defined.We have a very cryptic error from
quimb
as soon as we compute something with this device if there is a mismatch between the circuit wires and those on the device.To circumvent this issue, we previously made
wires
the last positional argument for this device (as inlightning.qubit
), checking at runtime if there's a mismatch between the wires on the device and those associated with the circuit.Description of the Change: We now instantiate the
quimb
tensor directly in thesimulate
function. The wires on the device are selected at runtime to match those on the circuit in case they haven't been provided by the user.Otherwise,
default.tensor
raises an informative error if the wires have been provided by the user and there is a mismatch.This allows the
wires
argument to be optional for this device.Benefits: This makes the
default.tensor
more flexible and, generally, more compatible with the existing devices in PL.Possible Drawbacks: As stated above, we have an error if there is a clear mismatch, such as:
which seems justified. However, the error disappears if we don't provide wires:
Related GitHub Issues: None.
Related Shortcut Stories: [sc-64007]