PennyLaneAI / pennylane

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.
https://pennylane.ai
Apache License 2.0
2.38k stars 607 forks source link

add `default_mixed.DefaultMixedNewAPI.preprocess` #6601

Closed JerryChen97 closed 1 day ago

JerryChen97 commented 1 week ago

Context: Updated: to lower the risk of breaking any current workflow, we put all the following-up implementation hooked with a new helper class default_mixed.DefaultMixedNewAPI.

In the implementation of new device API for default_mixed, the method preprocess is for literally preprocess of execution configuration. Specifically, this method should take input a ExecutionConfig, add validations for wires, measeruments and observables, and decompose transform inside itself, and finally return a tuple containing firstly the transform program and secondly the preprocessed config.

Description of the Change:

Benefits: One crucial step towards new API of mixed dev

Possible Drawbacks:

Related GitHub Issues: [sc-78674]

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.65%. Comparing base (aae481a) to head (939e26e). Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #6601 +/- ## ======================================= Coverage 99.65% 99.65% ======================================= Files 455 455 Lines 42881 42936 +55 ======================================= + Hits 42732 42787 +55 Misses 149 149 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

JerryChen97 commented 1 week ago

Instead of directly adding to the old DefaultMixed class, can you leave the old one as is and create a new class called DefaultMixedNewAPI that extends the new device API? Once the new device is ready, we can rename it to DefaultMixed and remove the old DefaultMixed class. This would be a lot cleaner.

This is exactly what I thought in the very beginning. Let me create another branch along with a new PR to implement this. After the new class is established I rebase this PR to it

JerryChen97 commented 1 day ago

@albi3ro do we have any other concerns for now?