qml.tape

Quantum tapes are a datastructure that can represent quantum circuits and measurement statistics in PennyLane. They are queuing contexts that can record quantum operations, execute devices, and compute gradients.

In addition to being created internally by QNodes, quantum tapes can also be created, nested, expanded (via expand()), and executed manually. Tape subclasses also provide additional gradient methods:

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

Warning

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

Functions

get_active_tape()

Returns the currently recording tape.

Classes

CVParamShiftTape([name, do_queue])

Quantum tape for CV parameter-shift analytic differentiation method.

JacobianTape([name, do_queue])

A quantum tape recorder, that records, validates, executes, and differentiates variational quantum programs.

OperationRecorder()

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

QuantumTape([name, do_queue])

A quantum tape recorder, that records, validates and executes variational quantum programs.

QubitParamShiftTape([name, do_queue])

Quantum tape for qubit parameter-shift analytic differentiation method.

ReversibleTape([name, do_queue])

Quantum tape for computing gradients via reversible analytic differentiation.

Unwrap(*tapes[, params, set_trainable])

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

UnwrapTape(tape[, params, set_trainable])

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

Class Inheritance Diagram

Inheritance diagram of pennylane.tape.cv_param_shift.CVParamShiftTape, pennylane.tape.jacobian_tape.JacobianTape, pennylane.tape.operation_recorder.OperationRecorder, pennylane.tape.tape.QuantumTape, pennylane.tape.qubit_param_shift.QubitParamShiftTape, pennylane.tape.reversible.ReversibleTape, pennylane.tape.unwrap.Unwrap, pennylane.tape.unwrap.UnwrapTape