Backend template
BackendTemplate()
Class to create new custom backend folder with file templates.
It will
follow the same structure as the built-in backends, namely fresnel1
and
pyqtorch
, having a folder with the custom backend name with the essential
files inside already built with the functions, classes and their methods.
Ex:
selected_root_dir/
└── custom_backends/
├── custom_backend1/
│ ├── __init__.py
│ ├── compiler.py
│ └── interface.py
It is intended to help the user when creating their custom backend with pre-filled files so the core structure of the backend instances are still present, while giving freedom for them to implement whatever else needed.
Source code in qadence2_platforms/utils/backend_template.py
create_folder(backend_name, current_path)
Creates the main folder for the custom backend in a selected path.
PARAMETER | DESCRIPTION |
---|---|
backend_name
|
backend name
TYPE:
|
current_path
|
current path to place the custom backend
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
bool
|
Returns true if the folder was already existing |
Source code in qadence2_platforms/utils/backend_template.py
create_template(backend_name, gui=True, use_this_dir=None)
Creates the template, with the main custom backend folder and its content files.
PARAMETER | DESCRIPTION |
---|---|
backend_name
|
backend name
TYPE:
|
gui
|
whether to use a GUI option to choose where to create the template;
tkinter must be installed.
On Mac:
TYPE:
|
use_this_dir
|
directory to create the custom backend
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
bool
|
Returns true if the template was successfully created |