-
Notifications
You must be signed in to change notification settings - Fork 51
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
Add Product
block encoding
#1106
Conversation
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.
Some minor things to consider, but LGTM
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.
Please add an explanation of the decomposition to the docstring and consider doing the partitions and unpartitions once outside the for-loop
I will do the suggested refactor to clean up the circuit diagram in a follow-up PR. @mpharrigan I've addressed all of the other feedback. |
'product_block_encoding', | ||
'product_block_encoding_override', | ||
'product_block_encoding_symb', |
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.
Why are these not serializable ?
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.
@charlesyuan314 I'll merge the PR and we can continue this discussion and potentially address in a follow-up PR
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.
I believe it is because this bloq has an attribute of type Tuple[BlockEncoding, ...]
. It results in the following at serialization time:
qualtran.testing.BloqCheckException: Serialization Failed:
Object arrays cannot be saved when allow_pickle=False
Are bloqs contained as attributes something that can be made serializable?
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.
Object arrays cannot be saved when allow_pickle=False
I think it's because so far we haven't had any bloq that stores a sequence of subbloqs as an attribute.
To support serialization we'll have to update
Qualtran/qualtran/protos/bloq.proto
Line 40 in f8d2db0
int32 subbloq = 7; |
NDArray subbloqs
that stores an NDArray of integers corresponding to IDs of each of the subbloqs and then update Qualtran/qualtran/serialization/bloq.py
Line 349 in f8d2db0
if isinstance(val, Bloq): |
Can you please open an issue to track this?
Add an instance of
BlockEncoding
that implements the product of constituent block encodings.