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.L1LossL1Loss
torch.nn.MSELossMSELoss
torch.nn.CrossEntropyLossCrossEntropyLoss
torch.nn.CTCLossCTCLoss
torch.nn.NLLLossNLLLoss
torch.nn.PoissonNLLLossPoissonNLLLoss
torch.nn.GaussianNLLLossGaussianNLLLoss
torch.nn.KLDivLossKLDivLoss
torch.nn.BCELossBCELoss
torch.nn.BCEWithLogitsLossBCEWithLogitsLoss
torch.nn.MarginRankingLossMarginRankingLoss
torch.nn.HingeEmbeddingLossHingeEmbeddingLoss
torch.nn.MultiLabelMarginLossMultiLabelMarginLoss
torch.nn.HuberLossHuberLoss
torch.nn.SmoothL1LossSmoothL1Loss
torch.nn.SoftMarginLossSoftMarginLoss
torch.nn.MultiLabelMarginLossMultiLabelMarginLoss
torch.nn.CosineEmbeddingLossCosineEmbeddingLoss
torch.nn.MultiMarginLossMultiMarginLoss
torch.nn.TripletMarginLossTripletMarginLoss
torch.nn.TripletMarginWithDistanceLossTripletMarginWithDistanceLoss
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.