Skip to content

Qadence 2 platforms compiler

compile_to_backend(model, backend)

Function that gets a Model (Qadence IR) and a backend name, and.

returns an Interface instance from the specific backend with the model transformed into backend appropriate data.

:param model: (Model) qadence IR :param backend: (str) the backend to be used to execute the Model :return: (Interface) interface instance of the chosen backend

Source code in qadence2_platforms/compiler.py
def compile_to_backend(model: Model, backend: str) -> Interface:
    """
    Function that gets a `Model` (Qadence IR) and a backend name, and.

    returns an `Interface` instance from the specific backend with the
    model transformed into backend appropriate data.

    :param model: (Model) qadence IR
    :param backend: (str) the backend to be used to execute the Model
    :return: (Interface) interface instance of the chosen backend
    """

    plat = module_loader(backend)
    return cast(Interface, plat.compile_to_backend(model))