qml.interfaces

Warning

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

See the main interfaces page for more details on available interfaces.

Modules

This subpackage defines functions for interfacing devices’ execution capabilities with different machine learning libraries.

Execution functions and utilities

execute(tapes, device[, gradient_fn, …])

New function to execute a batch of tapes on a device in an autodifferentiable-compatible manner.

cache_execute(fn, cache[, pass_kwargs, …])

Decorator that adds caching to a function that executes multiple tapes on a device.

set_shots(device, shots)

Context manager to temporarily change the shots of a device.

Supported interfaces

autograd

This module contains functions for adding the Autograd interface to a PennyLane Device class.

jax

This module contains functions for binding JVP’s or VJP’s to the JAX interface.

jax_jit

This module contains functions for binding JVPs or VJPs to JAX when using JIT.

tensorflow

This module contains functions for adding the TensorFlow interface to a PennyLane Device class.

tensorflow_autograph

This module contains functions for adding the TensorFlow Autograph interface to a PennyLane Device class.

torch

This module contains functions for adding the PyTorch interface to a PennyLane Device class.

Jacobian Product Calculation

JacobianProductCalculator()

Provides methods for calculating the JVP/VJP between the Jacobians of tapes and tangents/cotangents.

TransformJacobianProducts(inner_execute, …)

Compute VJPs, JVPs and Jacobians via a gradient transform TransformDispatcher.

DeviceDerivatives(device[, …])

Calculate jacobian products via a device provided jacobian.

DeviceJacobianProducts(device, execution_config)

Compute jacobian products using the native device methods.