Comments (5)
Hi @mlxd, thanks for the explanation for taking a look! :) The example came up during a discussion, rather than as something that the plugin should support. It was surprising to see the error, as the snippet seems to execute well with the latest master
version (not with the released version though). There might be perhaps some new updates that allow this to work. All in all, I think this would not be something that lightning should definitely support at the moment.
from pennylane-lightning.
Can this be closed?
from pennylane-lightning.
Hey @ankit27kh and thanks for sharing!
Looking through the code you shared, the error may be linked to defining the custom MyRX
gate. Please could you confirm whether the following successfully provides the gradient:
import pennylane as qml
from pennylane import numpy as np
dev = qml.device('lightning.qubit', wires=1)
@qml.qnode(dev)
def circuit(x):
qml.RX(x, wires=0)
return qml.expval(qml.PauliZ(0))
par = np.array(0.3)
qml.grad(circuit)(par)
Regarding the use of the custom MyRX
gate, I'm curious what the use case is? It might be useful to check out the available operations in PennyLane. If you have an arbitrary unitary, you may want to consider using qml.QubitUnitary.
Hope this helps!
from pennylane-lightning.
Hi @trbromley, this code was created to show a particular example for when we specify diff_method='best'
and use finite differences to estimate the gradient. MyRX
was created as an example of an operation that doesn't support analytic gradients. See the original comment here.
from pennylane-lightning.
Hi @antalszava. Lightning's current design will not support the use of custom gates in this way, as we intended to allow use of the supported gate-set and anything else to require use of the explicit matrix for custom gates. This is due to the gate-set being built as const
at compile time.
Is the above example something we should be supporting?
from pennylane-lightning.
Related Issues (20)
- Adjoint jacobian throws std::range_error
- Follow PennyLane `default.qubit` implementation for identity ops
- Python test suite in Lightning fails after removing deprecated tape execution methods in PennyLane HOT 3
- Use GCC for macOS wheels/tests HOT 1
- Handle IsingXY gate HOT 5
- MacOS arm64 wheels installed via pip result in ImportError HOT 4
- Support the same set of observables in forward/backward path HOT 1
- Add LM implementations of CSWAP & Toffoli gates HOT 2
- Update MacOS min version support to MacOS 11 HOT 1
- Docker Creation Fail GCC version and Test Fail HOT 7
- CodeCov report different coverage depending on the runner HOT 1
- Don't use brew for llvm path HOT 12
- Improve tests and checks workflows
- Ensure templated floating-point values are used throughout
- Update GCC 10.x to 11.x in CI tests HOT 1
- Update wheel-builder compiler from GCC 10.x to GCC 11.x
- Bug with probability returned by lightning
- Gate SingleExcitation not supported on device lightning.qubit HOT 2
- Unable to build from pypi source tarball HOT 2
- UserWarning: Pre-compiled binaries for lightning.qubit are not available HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pennylane-lightning.