-
Notifications
You must be signed in to change notification settings - Fork 616
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix possibility of falsy zero logic for
work_wires
in templates (#6720
) **Context:** Follow up to #6713. Previously, `work_wires=0` was incorrectly being mapped to an empty list, ```python >>> qml.Adder(1, x_wires=(), mod=1, work_wires=0) TypeError: object of type 'int' has no len() ``` Now, we have it properly handled, ```python >>> qml.Adder(1, x_wires=(), mod=1, work_wires=0) Adder(wires=[0]) >>> qml.Adder(1, x_wires=(), mod=1, work_wires=None) ValueError: Adder: wrong number of wires. At least one wire has to be given. ``` **Description of the Change:** **Source Code** Change the faulty logic of `work_wires = work_wires or ()` which will fail if `work_wires=0`. **Test Suite** Added tests to templates that allow single work wires, ensuring `work_wires=0` can be passed. **Benefits:** Fixes possibility of falsy zero logic in `work_wires`. **Possible Drawbacks:** None. [[sc-80454](https://app.shortcut.com/xanaduai/story/80454)] --------- Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
- Loading branch information
1 parent
4555833
commit 579e70d
Showing
12 changed files
with
34 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters