iqm.cpc.compiler.compilation_stage.compiler_pass#
- iqm.cpc.compiler.compilation_stage.compiler_pass(function)#
Convenience wrapper to create a valid compiler pass.
When the wrapped function is called, the compilation data (e.g. circuits) is passed as the first argument. If
functionhas any other arguments, they are either sweepable stage options or default members of the stateful compiler context. If a compiler pass needs as its input data that is not a sweepable compiler option or one of the default context members, this data must be provided into the context by some other pass function or manually by the user, and the pass function should havecontextas one of its arguments. The final wrapped compiler then have uniform signatures:(data_, context, options).- Parameters:
function (Callable) – The function to be wrapped into a valid compiler pass. It must return the
datafor the subsequent passes and any stateful side effects can be achieved via manipulation the compiler context.- Returns:
functionwrapped into a compiler pass, i.e. the same functionality as originally but with the signature(data_, context, options).
- Return type: