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

[BUG] Controlled ZYZ decomp fails for operators with torch parameters #5185

Closed
1 task done
lillian542 opened this issue Feb 8, 2024 · 0 comments · Fixed by #5183
Closed
1 task done

[BUG] Controlled ZYZ decomp fails for operators with torch parameters #5185

lillian542 opened this issue Feb 8, 2024 · 0 comments · Fixed by #5183
Labels
bug 🐛 Something isn't working

Comments

@lillian542
Copy link
Contributor

Expected behavior

ctrl_decomp_zyz with a target with torch parameters runs successfully

Actual behavior

a TypeError is raised in qml.math.isclose

Additional information

from forum post: https://discuss.pennylane.ai/t/precautions-to-take-when-switching-to-an-ibm-device/3982/6

Source code

target_op = qml.RY(torch.Tensor([1.2]), 0)
ctrl_decomp_zyz(target_op, 1)

Tracebacks

No response

System information

pl dev

Existing GitHub issues

  • I have searched existing GitHub issues to make sure the issue does not already exist.
@lillian542 lillian542 added the bug 🐛 Something isn't working label Feb 8, 2024
@lillian542 lillian542 changed the title [BUG] [BUG] Controlled ZYZ decomp fails for operators with torch parameters Feb 8, 2024
@lillian542 lillian542 linked a pull request Feb 8, 2024 that will close this issue
albi3ro pushed a commit that referenced this issue Feb 9, 2024
**Context:**
`ctrl_decomp_zyz` with a target with `torch` parameters fails because
`qml.math.isclose(torch.Tensor, float)` raises a `TypeError`. From forum
post
[here](https://discuss.pennylane.ai/t/precautions-to-take-when-switching-to-an-ibm-device/3982/6).

**Description of the Change:**
Switching to `qml.math.isclose(float, torch.Tensor)` seems to appease
PyTorch.

**Related GitHub Issues:**
#5185
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant