execute(tapes, device, execute_fn, gradient_fn, gradient_kwargs, _n=1, max_diff=2, grad_on_execution=None)¶
Execute a batch of tapes with TensorFlow parameters on a device.
tapes (Sequence[QuantumTape]) – batch of tapes to execute
device (pennylane.Device) – Device to use to execute the batch of tapes. If the device does not provide a
batch_executemethod, by default the tapes will be executed in serial.
execute_fn (callable) – The execution function used to execute the tapes during the forward pass. This function must return a tuple
(results, jacobians). If
jacobiansis an empty list, then
gradient_fnis used to compute the gradients during the backwards pass.
gradient_kwargs (dict) – dictionary of keyword arguments to pass when determining the gradients of tapes
gradient_fn (callable) – the gradient function to use to compute quantum gradients
_n (int) – a positive integer used to track nesting of derivatives, for example if the nth-order derivative is requested.
max_diff (int) – If
gradient_fnis a gradient transform, this option specifies the maximum number of derivatives to support. Increasing this value allows for higher order derivatives to be extracted, at the cost of additional (classical) computational overhead during the backwards pass.
grad_on_execution (bool) – Whether the gradients should be computed on execution or not.
A nested list of tape results. Each element in the returned list corresponds in order to the provided tapes.
- Return type
- What is PennyLane?
- Quantum circuits
- Gradients and training
- Quantum operators
- Inspecting circuits
- Compiling circuits
- Quantum Chemistry
- Quantum Datasets
- QNode returns