Skip to content
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

Update deprecated usage of tape and qtape properties in QNode #1266

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

andrijapau
Copy link

Summary:

Updating deprecated code that was introduced from a recent deprecation PennyLaneAI/pennylane#6583.

[sc-76836]

This comment was marked as resolved.

@andrijapau andrijapau changed the title Update deprecated usage of tape and qtape in QNode Update deprecated usage of tape and qtape properties in QNode Nov 14, 2024
Copy link

github-actions bot commented Nov 14, 2024

Thank you for opening this pull request.

You can find the built site at this link.

Deployment Info:

  • Pull Request ID: 1266
  • Deployment SHA: 544b7db0f703f517bbb448a4b502d6babaacf376
    (The Deployment SHA refers to the latest commit hash the docs were built from)

Note: It may take several minutes for updates to this pull request to be reflected on the deployed site.

cost.construct([params - self.finite_diff_step * direction], {})
tape_backward = cost.tape.copy(copy_operations=True)
tape_forward = qml.workflow.construct_tape(cost)(*[params + self.finite_diff_step * direction])
tape_backward = qml.workflow.construct_tape(cost)(*[params - self.finite_diff_step * direction])
Copy link
Member

Choose a reason for hiding this comment

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

Hey @andrijapau, quick question; could this part of the tutorial be rewritten as a transform?

Copy link
Author

Choose a reason for hiding this comment

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

Hi @josh146 , good point! Yes, a transform probably can be done given we are taking a tape and creating two tapes with modified parameters. Although, I think it might be a bit out of scope for this deprecation.

@albi3ro, what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Imo it'll make the implementation longer and consequently, the demo less readable.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would say out of scope for a quick deprecation change.

Copy link
Contributor

@mudit2812 mudit2812 left a comment

Choose a reason for hiding this comment

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

qnspsa demo's metadata.json file is missing an update.

cost.construct([params - self.finite_diff_step * direction], {})
tape_backward = cost.tape.copy(copy_operations=True)
tape_forward = qml.workflow.construct_tape(cost)(*[params + self.finite_diff_step * direction])
tape_backward = qml.workflow.construct_tape(cost)(*[params - self.finite_diff_step * direction])
Copy link
Contributor

Choose a reason for hiding this comment

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

Imo it'll make the implementation longer and consequently, the demo less readable.

Copy link
Contributor

@mudit2812 mudit2812 left a comment

Choose a reason for hiding this comment

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

No blockers from my end so I'm approving, but you should probably wait to merge until the conversation Josh brought up is resolved.

demonstrations/qnspsa.py Outdated Show resolved Hide resolved
demonstrations/qnspsa.py Outdated Show resolved Hide resolved
Copy link
Contributor

@albi3ro albi3ro left a comment

Choose a reason for hiding this comment

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

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants