pennylane icon indicating copy to clipboard operation
pennylane copied to clipboard

Add `QuantumScript`, move `QuantumTape` properties and methods there

Open albi3ro opened this issue 2 years ago • 3 comments

This PR introduces the new qml.qscript.QuantumScript class. This class in the non-queuing parts of QuantumTape. The QuantumTape can still be used as normal.

This class can now be created like:

from pennylane.qscript import QuantumScript

qscript = QuantumScript(ops=[qml.PauliX(0), qml.PauliY(1)], measurements=[qml.expval(qml.PauliZ(0)])

This object can still be executed:

qml.device('default.qubit', wires=2).execute(qscript)

Documentation page is here: https://xanaduai-pennylane--3097.com.readthedocs.build/en/3097/code/api/pennylane.tape.QuantumScript.html#pennylane.tape.QuantumScript

I can't figure out why it isn't included on the tape module page.

albi3ro avatar Sep 21 '22 16:09 albi3ro

Hello. You may have forgotten to update the changelog! Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

github-actions[bot] avatar Sep 21 '22 16:09 github-actions[bot]

Codecov Report

Merging #3097 (97527b1) into master (8e93231) will decrease coverage by 0.00%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #3097      +/-   ##
==========================================
- Coverage   99.69%   99.69%   -0.01%     
==========================================
  Files         274      275       +1     
  Lines       23924    23921       -3     
==========================================
- Hits        23850    23847       -3     
  Misses         74       74              
Impacted Files Coverage Δ
pennylane/ops/qubit/hamiltonian.py 100.00% <ø> (ø)
pennylane/optimize/lie_algebra.py 100.00% <100.00%> (ø)
pennylane/tape/__init__.py 100.00% <100.00%> (ø)
pennylane/tape/operation_recorder.py 100.00% <100.00%> (ø)
pennylane/tape/qscript.py 100.00% <100.00%> (ø)
pennylane/tape/tape.py 97.56% <100.00%> (-1.83%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Sep 21 '22 18:09 codecov[bot]

[sc-26070] [sc-26069]

albi3ro avatar Sep 21 '22 18:09 albi3ro