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

seed in qml.device("lightning.qubit", ...) seemingly does nothing #987

Open
isaacdevlugt opened this issue Nov 7, 2024 · 0 comments
Open

Comments

@isaacdevlugt
Copy link
Contributor

Issue description

The seed kwarg in device doesn't do anything for lightning.qubit. The results below are not fixed by seed.

  • Expected behavior: Since all sampling behaviour in lightning qubit happens in the C++ layer and PennyLane doesn't use the seed argument to configure that at all, lightning qubit shouldn't accept a seed keyword argument (it should be removed).

  • Actual behavior: It accepts seed and does nothing with it.

  • Reproduces how often: 1000%

  • System information:

Name: PennyLane
Version: 0.39.0
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: [/Users/isaac/.virtualenvs/pennylane-catalyst/lib/python3.11/site-packages](https://file+.vscode-resource.vscode-cdn.net/Users/isaac/.virtualenvs/pennylane-catalyst/lib/python3.11/site-packages)
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, toml, typing-extensions
Required-by: PennyLane-Catalyst, PennyLane_Lightning

Platform info:           macOS-15.1-arm64-arm-64bit
Python version:          3.11.9
Numpy version:           1.26.4
Scipy version:           1.12.0
Installed devices:
- default.clifford (PennyLane-0.39.0)
- default.gaussian (PennyLane-0.39.0)
- default.mixed (PennyLane-0.39.0)
- default.qubit (PennyLane-0.39.0)
- default.qutrit (PennyLane-0.39.0)
- default.qutrit.mixed (PennyLane-0.39.0)
- default.tensor (PennyLane-0.39.0)
- null.qubit (PennyLane-0.39.0)
- reference.qubit (PennyLane-0.39.0)
- nvidia.custatevec (PennyLane-Catalyst-0.9.0)
- nvidia.cutensornet (PennyLane-Catalyst-0.9.0)
- oqc.cloud (PennyLane-Catalyst-0.9.0)
- softwareq.qpp (PennyLane-Catalyst-0.9.0)
- lightning.qubit (PennyLane_Lightning-0.39.0)

Source code and tracebacks

import pennylane as qml

dev = qml.device("lightning.qubit", wires=4, shots=100, seed=52)

@qml.qnode(dev)
def node():
    qml.Hadamard(0)
    return qml.expval(qml.Z(0))

for i in range(10):
    print(node(4))
-0.16
0.14
0.02
0.06

Additional information

--

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

No branches or pull requests

1 participant