-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Support binding/assigning parameters by name #7107
Comments
I helped someone in Slack recently who had assumed that this would be possible, and was surprised that it wasn't, so there's an indirect +1 on this from them. |
Yes, I am the one who you helped @jakelishman. Thanks for that!! I was surprised because for example in myQLM you can bind parameters by the string name. You may not have access to the parameter variable name, and only to its string name. I would like to be assigned this issue to fix this problem if possible. Thanks. |
Sure @VicentePerezSoloviev, let us know if you have any questions! |
This would be a most welcome improvement. |
This issue seems to be blocking the high priority #11227 . As such, tagging it as high priority too. |
At the time I assigned this to myself in October, this was my intended route for this PR:
In service of the first bullet, I found a couple of bugs and problems in implementation that I intended to fix and refactor on the way through, since parameter-handling code was growing into new places. This leads to the current dependency chain, where each PR depends on the one above it:
|
The API change to
|
It's technically possible to skip to the last step of immediately implementing this PR, but if we do skip the dependency chain, then there's a fair amount more code duplication and potential surface for bugs in the parameter handling, because more and more places are having to do special-case lookup between various incompatible places doing partial parameter tracking. It'd be harder for me to write correctly, and more likely to become incorrect in the future if we don't fix the bug tail that I turned up while trying to write the initial version of it. |
Alright, all the PRs in the dependency chain are now open (though dependent on their predecessors), so people can build off a concrete proposal if they choose to. |
What is the expected enhancement?
From @Cryoris 's comment in #5557 (comment) :
We should consider adding support for binding and assigning parameters via their string name. This was originally omitted for concerns over overlapping parameter names between different circuits. However, by the stage of
bind_
/assign_
, theParameter
s on a given circuit are fixed and guaranteed to be unique, so there isn't really a possibility for the ambiguity that exists when composing two parameterized circuits.The text was updated successfully, but these errors were encountered: