helios.losses.utils¶
Attributes¶
Global instance of the registry for loss functions. |
Functions¶
|
Create the loss function for the given type. |
Module Contents¶
- helios.losses.utils.LOSS_REGISTRY¶
Global instance of the registry for loss functions.
By default, the registry contains the following losses:
Optimizers¶ Loss
Name
torch.nn.L1Loss
L1Loss
torch.nn.MSELoss
MSELoss
torch.nn.CrossEntropyLoss
CrossEntropyLoss
torch.nn.CTCLoss
CTCLoss
torch.nn.NLLLoss
NLLLoss
torch.nn.PoissonNLLLoss
PoissonNLLLoss
torch.nn.GaussianNLLLoss
GaussianNLLLoss
torch.nn.KLDivLoss
KLDivLoss
torch.nn.BCELoss
BCELoss
torch.nn.BCEWithLogitsLoss
BCEWithLogitsLoss
torch.nn.MarginRankingLoss
MarginRankingLoss
torch.nn.HingeEmbeddingLoss
HingeEmbeddingLoss
torch.nn.MultiLabelMarginLoss
MultiLabelMarginLoss
torch.nn.HuberLoss
HuberLoss
torch.nn.SmoothL1Loss
SmoothL1Loss
torch.nn.SoftMarginLoss
SoftMarginLoss
torch.nn.MultiLabelMarginLoss
MultiLabelMarginLoss
torch.nn.CosineEmbeddingLoss
CosineEmbeddingLoss
torch.nn.MultiMarginLoss
MultiMarginLoss
torch.nn.TripletMarginLoss
TripletMarginLoss
torch.nn.TripletMarginWithDistanceLoss
TripletMarginWithDistanceLoss
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.