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] dtype promotion to complex128 with tensorflow SProds _only_ in pauli_rep #5245

Closed
Qottmann opened this issue Feb 22, 2024 · 1 comment
Labels
bug 🐛 Something isn't working

Comments

@Qottmann
Copy link
Contributor

We are currently promoting the dtype of tensorflow variables in the pauli rep of scalar products, this leads to some unexpected and inconsistent behavior, e.g.

op = qml.s_prod(tf.constant(0.5), X(0))
print(op.scalar)
print(next(iter(op.pauli_rep.values())))
(<tf.Tensor: shape=(), dtype=float32, numpy=0.5>,
 <tf.Tensor: shape=(), dtype=complex128, numpy=(0.5+0j)>)

This problem stems from this line https://github.com/PennyLaneAI/pennylane/blob/master/pennylane/ops/op_math/sprod.py#L152

@Alex-Preciado
Copy link
Contributor

Closed with #5246

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

No branches or pull requests

2 participants