def register_task()

in optimum/exporters/executorch/task_registry.py [0:0]


def register_task(task_name):
    """
    Decorator to register a task under a specific name.

    Args:
        task_name (`str`):
            The name of the task to associate with a callable task.

    Returns:
        `Callable`:
            The original function wrapped as a registered task.

    Example:
        ```python
        @register_task("my_new_task")
        def my_new_task(...):
            ...
        ```
    """

    def decorator(func):
        task_registry[task_name] = func
        return func

    return decorator