catalyst.passes.apply_pass

apply_pass(pass_name: str, *flags, **valued_options)[source]

Applies a single pass to the QNode, where the pass is from Catalyst or a third-party if entry_points has been implemented. See the compiler plugin documentation for more details.

Parameters
  • pass_name (str) – Name of the pass

  • *flags – Pass options

  • **valued_options – options with values

Returns

Function that can be used as a decorator to a QNode. E.g.,

@passes.apply_pass("merge-rotations")
@qml.qnode(qml.device("lightning.qubit", wires=1))
def qnode():
    return qml.state()

@qml.qjit(target="mlir")
def module():
    return qnode()