qp.decomposition.register_signature

register_signature(op, **kwargs)

Register a possible signature for an operator.

A signature is a fully abstract instance of an operator, capturing the abstract type of every argument (its dynamic parameters and wires) along with the values of any static arguments. Registered signatures are collected in signature_registry() and are used to determine ahead of time which decomposition rules can be precompiled, improving the performance of decomposition passes in qjit()-compiled workflows.

Parameters:

op (Operator2 | type[Operator2]) – the operator to register a signature for. If an operator instance is given, it must be fully abstract and is stored as-is. If an operator type is given, its arg_specs (optionally overridden by keyword arguments) are used to construct the abstract instance when the registry is materialized.

Keyword Arguments:

**kwargs – the type or value of each argument, overriding the corresponding entry in op.arg_specs. Together with op.arg_specs these must cover every argument of the operator. These can only be provided when op is an operator type, not an instance.

Raises:

ValueError – if keyword arguments are provided together with an operator instance; if an operator instance is not fully abstract; if the provided specs do not cover every argument of the operator; or if a dynamic or wire argument is not fully abstract.

Contents

Using PennyLane

Release news

Development

API

Internals