Loss Functions
EikonalLoss()
The Eikonal loss regularizes the gradient of a neural implicit to have unit norm everywhere:
The gradient is computed from the input \(X\) and the output \(Y\) of the neural model.
__call__(X, Y)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
Tensor
|
input batch of the model |
required |
Y
|
Tensor
|
output of the model. |
required |
Returns:
| Type | Description |
|---|---|
|
torch.Tensor: Eikonal loss |
HKRLoss(margin=0.01, lmbd=10.0)
Hinge Kantorovitch-Rubinstein loss
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
margin
|
float
|
hinge margin. Must be small but not too small. Defaults to 1e-2. |
0.01
|
lmbd
|
float
|
weight balance between the two terms.. Defaults to 10. |
10.0
|
References
- Achieving robustness in classification using optimal transport with hinge regularization, Serrurier et al., 2021
- 1-Lipschitz neural distance fields, Coiffier and Béthune, 2024
__call__(y)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
Tensor
|
vector of predicted values |
required |
HotspotLoss(lmbd)
References
- HotSpot: Signed Distance Function Optimization with an Asymptotically Sufficient Condition, Wang et al., 2025
SALDLoss()
Sign agnostic learning loss with derivatives
References
SALD: Sign Agnostic Learning with Derivatives, Atzmon and Lipman, 2020
__call__(y_pred, y_target)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y_pred
|
Tensor
|
predicted values by the model |
required |
y_target
|
Tensor
|
target values |
required |
SALLoss(l=1.0, metric='l2')
Signed agnostic learning loss.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
l
|
float
|
Power value for the distance. Defaults to 1. |
1.0
|
metric
|
str
|
which metric to use. Choices are "l2" and "l0". Defaults to "l2". |
'l2'
|
References
SAL: Sign Agnostic Learning of Shapes From Raw Data, Atzmon and Lipman, 2020
__call__(y_pred, y_target)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y_pred
|
Tensor
|
predicted values by the model |
required |
y_target
|
Tensor
|
target values |
required |
SingularHessianLoss
TODO
ThinPlateLoss
References
VectorAlignmentLoss()
Cosine similarity loss between two vectors.
__call__(y, target)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
Tensor
|
input tensor |
required |
target
|
Tensor
|
target tensor |
required |
Returns:
| Type | Description |
|---|---|
|
torch.Tensor: Cosine similarity |