mindspore.graph.register_custom_backend
- mindspore.graph.register_custom_backend(backend_name, backend_path)[source]
Register a custom backend with MindSpore and use it for model compilation and execution.
Note
Custom backend only takes effect when using @jit, and the backend parameter in the @jit decorator must be consistent with the registered backend name.
This interface only supports Linux systems.
- Parameters
- Returns
bool. Return True if the custom backend is successfully registered; otherwise, False is returned.
- Raises
ValueError – If the custom backend path does not exist or the file is invalid.
Examples
>>> import mindspore.graph as graph >>> from mindspore import mint, jit >>> # Register a custom backend >>> success = graph.register_custom_backend( ... backend_name="my_backend", ... backend_path="/path/to/my_backend.so", ... ) >>> print(f"Registration successful: {success}") >>> # Use the custom backend >>> @jit(backend="my_backend") ... def my_func(x): ... return mint.sin(x)