qml.devices.qubit.adjoint_jacobian

adjoint_jacobian(tape, state=None)[source]

Implements the adjoint method outlined in Jones and Gacon to differentiate an input tape.

After a forward pass, the circuit is reversed by iteratively applying adjoint gates to scan backwards through the circuit.

Note

The adjoint differentiation method has the following restrictions:

  • Cannot differentiate with respect to observables.

  • Cannot differentiate with respect to state-prep operations.

  • Observable being measured must have a matrix.

Parameters
  • tape (QuantumTape) – circuit that the function takes the gradient of

  • state (TensorLike) – the final state of the circuit; if not provided, the final state will be computed by executing the tape

Returns

the derivative of the tape with respect to trainable parameters. Dimensions are (len(observables), len(trainable_params)).

Return type

array or tuple[array]

Contents

Using PennyLane

Release news

Development

API

Internals