kaira.losses.LossRegistry

Inheritance diagram for LossRegistry
- class kaira.losses.LossRegistry[source]
Bases:
objectA registry for loss functions in Kaira.
This class provides a centralized registry for all loss functions, making it easier to instantiate them by name with appropriate parameters.
Methods
Create a loss instance by name.
Get a loss class by name.
List all available losses in the registry.
Register a new loss in the registry.
Decorator to register a loss class in the registry.
- classmethod register(name: str, loss_class: Type[BaseLoss]) None[source]
Register a new loss in the registry.
- classmethod register_loss(name: str | None = None) Callable[source]
Decorator to register a loss class in the registry.
- Parameters:
name (Optional[str], optional) – The name to register the loss under. If None, the class name will be used (converted to lowercase).
- Returns:
A decorator function that registers the loss class.
- Return type:
callable
- classmethod list_losses() list[source]
List all available losses in the registry.
- Returns:
A list of loss names.
- Return type:
- __init__()