Comments (10)
Some updates to the docs have been done in af14a14, but these will still need to updated and polished further before release
from pennylane.
Putting a note here so that we remember to include each of the employed gradient formulas on the conventions page
from pennylane.
I read through the documentation, and there is already a lot there.
from pennylane.
But what I don't understand is the concept of a quantum node as opposed to a quantum function.
from pennylane.
(Sorry, keep hitting the wrong enter key). Is it necessary to have both concepts? Aren't they somewhat the same, and we can use quantum function which controls a quantum device?
In short, this is confusing to the reader and I'm not sure we need it.
from pennylane.
Yes, this is a discussion @josh146 and I have had previously. At some point, I had the same thoughts about these two similar concepts being redundant.
One distinction is that a quantum function is a just mathematical object which happens to be efficiently computable on a quantum device. On the other hand, the QNode is a particular abstraction, with fixed rules about how classical information is converted to quantum information, and back again.
from pennylane.
My suggestion is to rename quantum function to quantum node and use only one concept. What do you think @josh146 @co9olguy ?
Either way, it would be good to know for the manuscript how we frame this.
from pennylane.
I'm very torn on the qfunc vs. qnode. On the one hand, I get the sort of abstraction Nathan mentions (a qfunc is a quantum function that can be run on a particular qnode, that is attached to a hardware device. One qfunc may be used to initialise multiple qnodes).
But, on the other hand, I am guilty of using qfunc/qnode interchangeably in my communication! Which indicates just how close a concept they are.
Using the QNode
class initializer, this abstraction is easy to visualise:
def quantum_function(x):
qm.RX(x, 0)
return qm.expectation.Z(0)
qnode1 = QNode(quantum_function, dev1)
qnode2 = QNode(quantum_function, dev2)
This is not possible currently if you use the qfunc
decorator, as this binds the following function to a QNode/device on function definition, and after that cannot be re-used (as there is no longer any access to the underlying qfunc).
I think we should keep both abstractions in the documentation. However, to avoid confusion, we should rename the decorator, since it essentially binds a qfunc to a qnode for the user.
Summary:
-
A quantum function is any Python function that conforms to our restricted OpenQML qfunc definition; i.e. can only use
qm.ops
, one per line, and must return an expectation value. -
A qfunc can be bound to a QNode on a device, which is used to build the hybrid computational graph. The same qfunc can be used in multiple QNodes.
@mariaschuld and I were discussing alternate names for the decorator. Options are:
@to_qnode
/@toqnode
@make_qnode
/@makeqnode`@qnode
(as opposed to the classQNode
, which is in uppercase)@QNode.bind
(make the decorator a class method ofQNode
)
My preference I think would be @qnode
, thoughts?
from pennylane.
Seconded @qnode
.
So I will use the concept of a qnode in the paper for now, and a quantum function is basically a wrapper for a variational or fixed circuit.
Can we somewhere write down the requirements of a quantum function so that the decorator works?
from pennylane.
I've removed the conventions page, and shifted a lot of what it was meant to cover to other parts of the library (e.g., under Supported Operations). Some further points that were written there are no longer important (e.g., since we put expvals always at the end of a circuit, there is no need to discuss subtleties of non-commuting measurements)
from pennylane.
Related Issues (20)
- [BUG] Shape mismatch occurs in gradient calculation when using an indexing operation with batched inputs and autograd HOT 1
- [BUG] qml.ThermalRelaxationError argument typo HOT 1
- [BUG] `qml.exp` does not work with `jax.jit` and workflows that require decomposition, since `Exp.decomposition` is not traceable HOT 5
- [BUG] `qml.equal` doesn't work with `PauliError` instances
- [BUG] `single_qubit_fusion` gets rid of the `GlobalPhase`
- [BUG] `BasisRotation` is not JAX compatible HOT 2
- [BUG] `BasisState` does not work with `jax.jit`
- [BUG] `BasisEmbedding` gives the wrong decomposition
- [BUG] `BasisEmbedding` does not work with `lightning.qubit` and `jax.jit` HOT 2
- [BUG] Mid-circuit measurements cannot be added to tapes in transforms HOT 9
- [BUG] jax interface does not support multicontrol gates HOT 1
- [BUG] `qml.qsvt` breaks with some angles
- [BUG] qml.expval returns unexpected values HOT 2
- LinAlgError: Singular matrix when trying to do qml.lie_closure on Heisenberg model
- [BUG] Discrepancy in output values of the example of `qml.pulse.drive` HOT 1
- [BUG] `SPSAOptimizer.step_and_cost` ignores keyword arguments HOT 1
- [BUG] Loading the MQT Bench dataset does not work as expected. HOT 1
- [BUG] Array indexing error when sampling after mid-circuit measurements are performed on other wires HOT 3
- NotImplementedError: VJP of eigvals wrt argnums (0,) not defined[BUG] HOT 2
- Implement `Hermitian.decomposition`
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.