Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Conversation

@swernli
Copy link
Contributor

@swernli swernli commented Oct 17, 2020

When generating an adjoint operation, first lift any nested expressions that are operation calls into their own lines, replacing the inline call with Unit, ie: ( ), since all adjointable operations must return Unit anyway. Doing this lifting before the statements in the scope get reversed ensures that they will be properly reversed instead of left in-order in the in-line expression.

Fixes #615

Copy link
Contributor

@ScottCarda-MS ScottCarda-MS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I've added some suggestions for reducing the additions to the public API.

@swernli swernli merged commit fdf7431 into main Oct 21, 2020
swernli added a commit that referenced this pull request Nov 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Order of evaluation in expressions can generate incorrect adjoints

4 participants