load_program(program: pyquil.quil.Program)[source]

Load a pyquil.Program instance as a PennyLane template.

During loading, gates are converted to PennyLane gates as far as possible. If the gates are not supported they are replaced with QubitUnitary instances. The import ignores all statements that are not declarations or gates (e.g. pragmas, classical control flow and measurements).

Every variable that is present in the Program and that is not used as the target register of a measurement has to be provided in the parameter_map of the template.


Starting from version 0.14.0 of PennyLane and PennyLane-Forest, converting from Forest is not supported.

Parameters:program (pyquil.Program) – The program that should be loaded
Returns:a ProgramLoader instance that can be called like a template
Return type:ProgramLoader