Adds a fake session to primitives
See original GitHub issueWhat should we add?
The base classes, reference implementations, and backend implementations of primitives do not take a session while qiskit-ibm-runtime version of primitives takes session to reduce latency. Here is a sample code of runtime estimator with session.
with Session(service=service, backend="ibmq_qasm_simulator") as session:
estimator = Estimator(session=session)
theta1 = [0, 1, 1, 2, 3, 5]
# calculate [ <psi1(theta1)|H1|psi1(theta1)> ]
psi1_H1 = estimator.run(circuits=[psi1], observables=[H1], parameter_values=[theta1])
print(psi1_H1.result())
If users implement algorithms with the base class or reference impl of primitives, the code cannot take advantage of session when they replace the primitives with the runtime version. If users implement algorithms with runtime primitives, they need to adjust the code to test their implementation using the reference impl. So, it would be useful to introduce a fake session and extend the base classes of primitives to take the fake session as an argument.
Issue Analytics
- State:
- Created 10 months ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
what is the best way to mock window.sessionStorage in jest
You probably do not even need a mock. Just use window.sessionStorage as usual and write your condition based on window.sessionStorage.getItem(..
Read more >Chapter 3. Hello Spark: primitives, components, FXG and ...
In this workshop session, we'll start work with the primitives that are the basic building block classes used by Spark components. (When I...
Read more >Is it possible to fake session variables? - PHP - SitePoint Forums
I was just wondering if malicious users are able to fake session variables? When a user logs on, I assign a session var...
Read more >Communication Primitives in Deep Learning Frameworks
Using TensorFlow API you would add “while not succeeded:” loops like these on operations such as session creation and run commands that catch ......
Read more >R Internals
Primitive. 2.1 Special primitives; 2.2 Special internals; 2.3 Prototypes for primitives; 2.4 Adding a primitive. 3 Internationalization in the R sources.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I should be clearer on this point: I mean that all the running of circuits on primitives is a defined part of the API, and so this code should look the same no matter what
Estimator
is used, but the actual constructor of anEstimator
isn’t part of the interface, so it’s totally normal for it to look a bit different between implementations.If there is meant to be a single defined construction method, then this needs formalising into an API that everyone can implement. For the
Backend
path, such a factory class is (approximately)Provider
, as an example. I personally don’t see a need for a unified construction interface here (I think they generally don’t reduce any complexity, they just move it to the construction of a different object), but I’m not the best person to design the UX of these interfaces.Thank you for your comment, Jake. I ask @adekusar-drl to describe the details of this request.