qml.exceptions

This module contains all the custom exceptions and warnings used in PennyLane.

Warning

Unless you are a PennyLane or plugin developer, you will likely not need to use these classes directly. They are raised by PennyLane functions when errors are encountered.

Contents

The exceptions and warnings are organized by their category of use.

General Execution Errors

CaptureError

Errors related to PennyLane's Program Capture execution pipeline.

DeviceError

Exception raised when it encounters an illegal operation in the quantum circuit.

QuantumFunctionError

Exception raised when an illegal operation is defined in a quantum function.

TransformError

Raised when there is an error with the transform logic.

ConditionalTransformError

Error for using qml.cond incorrectly

QueuingError

Exception that is raised when there is a queuing error

WireError

Exception raised by a Wire object when it is unable to process wires.

MeasurementShapeError

An error raised when an unsupported operation is attempted with a quantum tape.

AutoGraphError

Errors related to PennyLane's AutoGraph submodule.

CompileError

Error encountered in the compilation phase.

DecompositionError

Base class for decomposition errors.

InvalidCapabilitiesError

Exception raised from invalid TOML files.

NonDifferentiableError

Exception raised if attempting to differentiate non-trainable tensor using Autograd.

Operator Property Errors

OperatorPropertyUndefined

Generic exception to be used for undefined Operator properties or methods.

DecompositionUndefinedError

Raised when an Operator's representation as a decomposition is undefined.

TermsUndefinedError

Raised when an Operator's representation as a linear combination is undefined.

MatrixUndefinedError

Raised when an Operator's matrix representation is undefined.

SparseMatrixUndefinedError

Raised when an Operator's sparse matrix representation is undefined.

EigvalsUndefinedError

Raised when an Operator's eigenvalues are undefined.

DiagGatesUndefinedError

Raised when an Operator's diagonalizing gates are undefined.

AdjointUndefinedError

Raised when an Operator's adjoint version is undefined.

PowUndefinedError

Raised when an Operator's power is undefined.

GeneratorUndefinedError

Exception used to indicate that an operator does not have a generator

ParameterFrequenciesUndefinedError

Exception used to indicate that an operator does not have parameter_frequencies

User Warnings

PennyLaneDeprecationWarning

Warning raised when a PennyLane feature is being deprecated.

ExperimentalWarning

Warning raised to indicate experimental/non-stable feature or support.

AutoGraphWarning

Warnings related to PennyLane's AutoGraph submodule.