helios.losses.utils

Attributes

LOSS_REGISTRY

Global instance of the registry for loss functions.

Functions

create_loss(→ torch.nn.Module)

Create the loss function for the given type.

Module Contents

helios.losses.utils.LOSS_REGISTRY

Global instance of the registry for loss functions.

Example

import helios.losses as hll

# This automatically registers your loss function.
@hll.LOSS_REGISTRY.register
class MyLoss:
    ...

# Alternatively you can manually register a loss function like this:
hll.LOSS_REGISTRY.register(MyLoss)
helios.losses.utils.create_loss(type_name: str, *args: Any, **kwargs: Any) torch.nn.Module[source]

Create the loss function for the given type.

Parameters:
  • type_name – the type of the loss to create.

  • args – positional arguments to pass into the loss.

  • kwargs – keyword arguments to pass into the loss.

Returns:

The loss function.