qml.transforms

This subpackage contains QNode, quantum function, device, and tape transforms.

QNode transforms

The following transforms act on QNodes. They return new transformed functions that compute the desired quantity.

classical_jacobian(qnode)

Returns a function to extract the Jacobian matrix of the classical part of a QNode.

draw(qnode[, charset, wire_order, …])

Create a function that draws the given qnode.

metric_tensor(qnode[, diag_approx, …])

Returns a function that returns the value of the metric tensor of a given QNode.

Quantum function transforms

The following transforms act on quantum functions (Python functions containing quantum operations) that are used inside QNodes.

adjoint(fn)

Create a function that applies the adjoint (inverse) of the provided operation or template.

ctrl(fn, control)

Create a method that applies a controlled version of the provided method.

invisible(fn)

A transform to make a quantum function non-recordable or invisible within a QNode or quantum tape context.

Tape transforms

The following transforms act on quantum tapes, and return one or more tapes as well as a classical processing function.

measurement_grouping(tape, obs_list, coeffs_list)

Returns a list of measurement optimized tapes, and a classical processing function, for evaluating the expectation value of a provided Hamiltonian.

metric_tensor_tape(tape[, diag_approx, wrt])

Returns a list of tapes, and a classical processing function, for computing the block diagonal metric tensor approximation of an input tape on hardware.