Quantum tapes are a datastructure that can represent quantum circuits and measurement statistics in PennyLane. They are queuing contexts that can record and process quantum operations and measurements.

In addition to being created internally by QNodes, quantum tapes can also be created, nested, expanded (via expand()), and executed manually.

Finally, quantum tapes are fully compatible with autodifferentiating via NumPy/Autograd, TensorFlow, and PyTorch.


Unless you are a PennyLane or plugin developer, you likely do not need to use these classes directly.

See the quantum circuits page for more details on creating QNodes, as well as the qnode() decorator and QNode() constructor.

pennylane.tape Package


OperationRecorder([ops, measurements, prep, …])

A template and quantum function inspector, allowing easy introspection of operators that have been applied without requiring a QNode.

QuantumScript([ops, measurements, prep, …])

The state preparation, operations, and measurements that represent instructions for execution on a quantum device.

QuantumTape([ops, measurements, prep, name, …])

A quantum tape recorder, that records and stores variational quantum programs.


An error raised with a quantum tape.

Unwrap(*tapes[, params])

A context manager that unwraps multiple tapes with tensor-like parameters to NumPy arrays.

UnwrapTape(tape[, params])

A context manager that unwraps a single tape with tensor-like parameters to NumPy arrays.

Class Inheritance Diagram

Inheritance diagram of pennylane.tape.operation_recorder.OperationRecorder, pennylane.tape.qscript.QuantumScript, pennylane.tape.tape.QuantumTape, pennylane.tape.tape.TapeError, pennylane.tape.unwrap.Unwrap, pennylane.tape.unwrap.UnwrapTape