Comments (12)
I believe this is caused by plugins having a larger set of implemented gates than openqml core. Safe to ignore for now.
At some point we intend to allow plugins to put their own gates in openqml, but I doubt this will make it into the initial release.
from pennylane.
It could also be typos, I'll double check. Things like Squeeze
instead of Squeezing
.
from pennylane.
I just had a look a the code and it looks like it should be rather easy to modify the OperationFactory
and ExpectationFactory
to also load operations/expectations from the plugin scope, such as openqml.plugins.[plugin].ops
. Both the ProjectQ and the SF plugin already have custom operations, so that would actually add value. Shall I give that a shot next week or do you want to wait until after 0.1?
from pennylane.
@josh146 this is your area of expertise; what do you think?
from pennylane.
I think this makes sense - it avoids the user having to import from both openqml and the plugin. There are only two pain points I can think of:
-
As this is not standard Python packaging behaviour, we'll have to make it very clear how this works in the plugin documentation.
-
If the user is working in an interactive environment, such as Jupyter, IPython or PyCharm, autocomplete likely won't work on the dynamically generated attributes.
from pennylane.
from pennylane.
Yep. The user should automatically be able to import it from the plugin if they wanted to, right? In fact, I can't see any obvious issues with them importing one of the current projectq plugin operations, it should just work.
I quite like this approach - I feel like, either way, the user will definitely be able to find the operations
from pennylane.
I looked into this. Some research reveals that __getattr__()
does not work on modules below python 3.7. :-( The there are some proposed hacks (see the link), but I am not sure how hacky we want to go here....
from pennylane.
Another option is to use setattr(openqml, 'foo', 'bar')
. I didn't expect it, but this can even already be used from __init__()
of openqml
! I think we can use that to add operations to the openqml
context during the initialization of a device, or, maybe even better during in the qfunc decorator. The special operations would then only be accessible via openqml.XXX(...)
during a qufunc with a device that actually supports them. I will look into that later today...
from pennylane.
@cgogolin let me know if you can get that working! My other concern would be what happens if two plugins are loaded with two operations with the same name? Having them accessible only within a particular QNode/device
that actually supports them would solve that issue.
Another thing: I've been thinking about test_installed_plugins
, and I'm not sure it belongs in OpenQML
base. The tests provided with OpenQML
should be testing the code provided with OpenQML
, such as the operations, gradients, devices, QNodes, and default plugins.
External plugins should be responsible for their own tests, including: making sure that the plugin device works as expected, and that all supported/unsupported operations work. The plugins themselves should not need to test gradients, as that should be covered by the base OpenQML
test suite.
Having test_installed_plugins
in OpenQML base is problematic, as it can cause the OpenQML test suite to fail depending on external Python packages the user has installed. Alternatively, we should provide a test suite template that plugin developers can use for their own testing purposes, perhaps based on test_default_plugin
or the SF/ProjectQ tests.
from pennylane.
Yes, that was my concern as well and this approach would solve this nicely.
I agree that test_installed_plugins should be moved out of the core openqml test suite before release, Please leave it there a little longer, because for the moment it is tremendously useful for me...
from pennylane.
This is fixed in #65. If you like that PR, we can close this issue.
from pennylane.
Related Issues (20)
- Improve decomposition in ``TrotterProduct``
- Add matrix support for fermionic objects
- [BUG][QUESTION] Cutting: Correctness of `qcut_processing_fn_sample`. HOT 2
- [BUG] Metric tensor fails under certain combinations of device and differentiation method HOT 1
- [BUG] QNGO doesn't work with circuits that take more than one argument HOT 1
- [BUG] Switching device from default.qubit to qiskit.aer makes workflow non-differentiable HOT 4
- [BUG] `dynamic_one_shot` sample probability not always bounded by 1.
- [BUG] Split non commuting fails with autograd `requires_grad=False` coefficients HOT 9
- [BUG] `qml.probs()` returns values outside the range of 0 to 1 HOT 2
- [BUG] Parameter-shift rule with postselected MCMs returns wrong values
- [BUG] `qml.measure` can not be used within the body of `qml.cond`
- Recursion error when accessing operator built using qml.prod
- [BUG] The order of the wires is not maintained in the `qml.QSVT` template
- [BUG] qml.ShotAdaptiveOptimizer doesnโt work with qiskit.aer HOT 2
- [BUG] Returning sums of duplicate observables uses incorrect sorting behaviour
- [BUG] Inconsistent behavior between lighning.qubit and default.qubit HOT 1
- [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
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.