catalyst.passes.apply_pass_plugin

apply_pass_plugin(path_to_plugin: str | Path, pass_name: str, *flags, **valued_options)[source]

Applies a pass plugin to the QNode. See the compiler plugin documentation for more details.

Parameters:
  • path_to_plugin (str | Path) – full path to plugin

  • 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.,

from standalone import getStandalonePluginAbsolutePath

@passes.apply_pass_plugin(getStandalonePluginAbsolutePath(), "standalone-switch-bar-foo")
@qml.qnode(qml.device("lightning.qubit", wires=1))
def qnode():
    return qml.state()

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