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] FABLE template returns incorrect value in JIT mode #6262

Closed
1 task done
willjmax opened this issue Sep 12, 2024 · 1 comment
Closed
1 task done

[BUG] FABLE template returns incorrect value in JIT mode #6262

willjmax opened this issue Sep 12, 2024 · 1 comment
Assignees
Labels
bug 🐛 Something isn't working

Comments

@willjmax
Copy link
Contributor

Expected behavior

The value returned by the FABLE template with JIT enabled should be approximately equal to the value without JIT enabled.

Actual behavior

The values are different.

Additional information

No response

Source code

def fable(input_matrix):
            qml.FABLE(input_matrix, wires=range(5), tol=0)
            return qml.expval(qml.PauliZ(wires=0))

        input_matrix = np.array(
            [
                [-0.5, -0.4, 0.6, 0.7],
                [0.9, 0.9, 0.8, 0.9],
                [0.8, 0.7, 0.9, 0.8],
                [0.9, 0.7, 0.8, 0.3],
            ]
        )

        device = qml.device("default.qubit", wires=5)
        interpreted_fn = qml.QNode(fable, device)
        jitted_fn = jax.jit(interpreted_fn)
        assert np.allclose(jitted_fn(input_matrix), interpreted_fn(input_matrix))

Tracebacks

No response

System information

Name: PennyLane
Version: 0.39.0.dev11
Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
Home-page: https://github.com/PennyLaneAI/pennylane
Author: 
Author-email: 
License: Apache License 2.0
Location: /home/william.maxwell/pennylane/pl-venv/lib/python3.9/site-packages
Editable project location: /home/william.maxwell/pennylane/pennylane
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, toml, typing-extensions
Required-by: amazon-braket-pennylane-plugin, PennyLane-Catalyst, PennyLane_Lightning, PennyLane_Lightning_Kokkos

Platform info:           Linux-6.8.0-40-generic-x86_64-with-glibc2.35
Python version:          3.9.19
Numpy version:           1.26.4
Scipy version:           1.12.0
Installed devices:
- default.clifford (PennyLane-0.39.0.dev11)
- default.gaussian (PennyLane-0.39.0.dev11)
- default.mixed (PennyLane-0.39.0.dev11)
- default.qubit (PennyLane-0.39.0.dev11)
- default.qubit.autograd (PennyLane-0.39.0.dev11)
- default.qubit.jax (PennyLane-0.39.0.dev11)
- default.qubit.legacy (PennyLane-0.39.0.dev11)
- default.qutrit (PennyLane-0.39.0.dev11)
- default.qutrit.mixed (PennyLane-0.39.0.dev11)
- default.tensor (PennyLane-0.39.0.dev11)
- null.qubit (PennyLane-0.39.0.dev11)
- lightning.qubit (PennyLane-Lightning-0.38.0)
- lightning.kokkos (PennyLane-Lightning-Kokkos-0.38.0)
- nvidia.custatevec (PennyLane-Catalyst-0.9.0.dev9)
- nvidia.cutensornet (PennyLane-Catalyst-0.9.0.dev9)
- oqc.cloud (PennyLane-Catalyst-0.9.0.dev9)
- softwareq.qpp (PennyLane-Catalyst-0.9.0.dev9)
- braket.aws.ahs (amazon-braket-pennylane-plugin-1.29.0)
- braket.aws.qubit (amazon-braket-pennylane-plugin-1.29.0)
- braket.local.ahs (amazon-braket-pennylane-plugin-1.29.0)
- braket.local.qubit (amazon-braket-pennylane-plugin-1.29.0)

Existing GitHub issues

  • I have searched existing GitHub issues to make sure the issue does not already exist.
@willjmax
Copy link
Contributor Author

Fixed in #6263

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

1 participant