-
Notifications
You must be signed in to change notification settings - Fork 0
Losses Documentation
Qisheng Robert He edited this page Jan 12, 2024
·
6 revisions
The main loss function
- extends:
Metric
- Could be use as a decorator of a function
@Loss
def loss_fn(input: torch.Tensor, target: torch.Tensor) -> torch.Tensor:
...
- Loss tensor is stayed in memory until reset is called
- Constructor:
- Parameters:
- loss_fn: A
Callable
function that accepts input ory_pred
inAny
kind and target ory_true
inAny
kind as inputs and gives a loss intorch.Tensor
- Parameters:
- loss_fn: A
The cross entropy loss
- extends:
Loss
The dice loss
- extends:
Loss
Combined Dice
loss and CrossEntropy
loss
- extends:
CrossEntropy
,Dice
The focal cross entropy loss
- extends:
Loss
- Constructor:
- Parameters:
- alpha: A
float
of alpha in focal cross entropy - gamma: Afloat
of gamma in focal cross entropy - calculate_average: Abool
flag of if calculate average for the focal loss
- Parameters:
- alpha: A
KL-Div Loss
- extends:
Loss
The MAE loss
- extends
_ReductableLoss
The MSE loss
- extends
_ReductableLoss
- Properties:
- reduction: A
.loss.Reduction
of reduction method - replace_nan: Aboolean
flag of if replacing nan results to zeros
A loss with multiple losses
- extends:
Loss
- Properties:
- losses: A
list
of loss metrics inMetric
- losses: A
A loss with multiple losses for multiple outputs
-
Pending Depreciation Warning:
MultiOutputsLosses
will be deprecated in v1.1.0, useMultiLosses
along withtarget
parameter for each loss instead. - extends:
Loss
- Properties:
- losses: A
dict
of loss metrics inMetric
- losses: A
The loss wrapping function that wrap a function into a loss
- Use as a decorator
@loss
def loss_fn(input: torch.Tensor, target: torch.Tensor) -> torch.Tensor:
...