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
There is a bug in the input validation for the BasisEmbedding template. It should be checking that the basis state array only contains 0 and 1 integers, but the way it is currently coded, it also disallows all-ones and all-zero basis states:
ValueError: Basis state must only consist of 0s and 1s; got [1, 1, 1]
However, this got me wondering: isn't BasisEmbedding identical toBasisStatePreparation? 🤔
For the latter, the check is correct and it seems as though it had the same functionality. Maybe @mariaschuld could also help here. If they are identical, we could maybe consider having BasisEmbedding depend on BasisStatePreparation and eventually deprecating it.
Yes, there is no real reason why we couldn't use BasisStatePreparation. I think I always thought it hacks the initial state, while I wanted a hardware-compatible solution for the embedding, but I guess this argument is not valid (any more). But this is a general decision, I propose to decouple it from this bug.
josh146
changed the title
The BasisState template does not allow for all-ones or all-zero basis states
The BasisEmbedding template does not allow for all-ones or all-zero basis states
Feb 28, 2021
There is a bug in the input validation for the
BasisEmbedding
template. It should be checking that the basis state array only contains 0 and 1 integers, but the way it is currently coded, it also disallows all-ones and all-zero basis states:https://github.com/PennyLaneAI/pennylane/blob/master/pennylane/templates/embeddings/basis.py#L54
The text was updated successfully, but these errors were encountered: