-
Notifications
You must be signed in to change notification settings - Fork 617
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle recursion errors in CompositeOp methods (#6375)
By default, `qml.sum` and `qml.prod` set `lazy=True`, which keeps its operands nested. Given the recursive nature of such structures, if there are too many levels of nesting, a `RecursionError` would occur when accessing many of the properties and methods. Catching these errors and re-raising a more sensible error message suggesting that the user could either set `lazy=False` or use the `+` and `@` operators instead, which sets `lazy=False`. **Update** Extending the behaviour to `SProd` Fixes #5948 [sc-67745]
- Loading branch information
Showing
7 changed files
with
140 additions
and
6 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
Oops, something went wrong.