From cffa08aa316c5f5256b8bb258ff9f249495464bc Mon Sep 17 00:00:00 2001 From: Austin Huang <65315367+austingmhuang@users.noreply.github.com> Date: Mon, 16 Dec 2024 12:55:45 -0500 Subject: [PATCH] Small fix for an overly aggressive warning (#6707) **Context:** Was raising a warning too aggressively. **Description of the Change:** Small change to make sure using numpy with autograd/jax doesn't raise a warning. **Benefits:** **Possible Drawbacks:** **Related GitHub Issues:** --- doc/releases/changelog-dev.md | 1 + pennylane/qchem/molecule.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 5d7c12db14e..2ba70266f8c 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -229,6 +229,7 @@ such as `shots`, `rng` and `prng_key`. * Added JAX support for the differentiable Hartree-Fock workflow. [(#6096)](https://github.com/PennyLaneAI/pennylane/pull/6096) + [(#6707)](https://github.com/PennyLaneAI/pennylane/pull/6707) * Added functions and dunder methods to add and multiply Resources objects in series and in parallel. [(#6567)](https://github.com/PennyLaneAI/pennylane/pull/6567) diff --git a/pennylane/qchem/molecule.py b/pennylane/qchem/molecule.py index e2a24e3c7fc..ed49cd0ac3a 100644 --- a/pennylane/qchem/molecule.py +++ b/pennylane/qchem/molecule.py @@ -144,7 +144,16 @@ def __init__( for i, c in enumerate(coeff) ] - if len(set(qml.math.get_deep_interface(x) for x in [coordinates, alpha, coeff])) > 1: + if ( + len( + { + qml.math.get_deep_interface(x) + for x in [coordinates, alpha, coeff] + if qml.math.get_deep_interface(x) != "numpy" + } + ) + > 1 + ): warnings.warn( "The parameters coordinates, coeff, and alpha are not of the same interface. Please use the same interface for all 3 or there may be unintended behavior.", UserWarning,