Module importer
module_loader(module_name)
Loads an arbitrary module and returns it.
It can be a backend submodule from
an already imported backend, i.e. "pyqtorch", an existing but not imported
module, i.e. "fresnel1", or a custom backend module, i.e. "custom_backend1".
It facilitates to import and work with custom modules for backends development, for instance.
| PARAMETER | DESCRIPTION |
|---|---|
module_name
|
The name of the module to load.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ModuleType
|
The loaded module. |
Source code in qadence2_platforms/utils/module_importer.py
resolve_module_path(module_source)
Resolve module path for custom backends.
It symlinks custom backends, if they are not symlinked yet, and ensure that relative imports from their files do not break.
| PARAMETER | DESCRIPTION |
|---|---|
module_source
|
module source path.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the module path is resolved, False otherwise. |