public class SimpleCompositeLoss extends AbstractCompositeLoss
SimpleCompositeLoss is an implementation of the Loss abstract class that can
combine different Loss functions by adding the individual losses together.
For cases where the losses use only a single index of the labels and/or predictions, use the
IndexLoss.
For an example of using this loss, see the captcha training example.
componentstotalInstances| Constructor and Description |
|---|
SimpleCompositeLoss()
Creates a new empty instance of
CompositeLoss that can combine the given Loss
components. |
SimpleCompositeLoss(java.lang.String name)
Creates a new empty instance of
CompositeLoss that can combine the given Loss
components. |
| Modifier and Type | Method and Description |
|---|---|
SimpleCompositeLoss |
addLoss(Loss loss)
Adds a Loss that applies to all labels and predictions to this composite loss.
|
protected ai.djl.util.Pair<NDList,NDList> |
inputForComponent(int componentIndex,
NDList labels,
NDList predictions)
Returns the inputs to computing the loss for a component loss.
|
addAccumulator, evaluate, getAccumulator, getComponents, resetAccumulator, updateAccumulatorelasticNetWeightedDecay, elasticNetWeightedDecay, elasticNetWeightedDecay, elasticNetWeightedDecay, hingeLoss, hingeLoss, hingeLoss, l1Loss, l1Loss, l1Loss, l1WeightedDecay, l1WeightedDecay, l1WeightedDecay, l2Loss, l2Loss, l2Loss, l2WeightedDecay, l2WeightedDecay, l2WeightedDecay, maskedSoftmaxCrossEntropyLoss, maskedSoftmaxCrossEntropyLoss, maskedSoftmaxCrossEntropyLoss, sigmoidBinaryCrossEntropyLoss, sigmoidBinaryCrossEntropyLoss, sigmoidBinaryCrossEntropyLoss, softmaxCrossEntropyLoss, softmaxCrossEntropyLoss, softmaxCrossEntropyLosscheckLabelShapes, checkLabelShapes, getNamepublic SimpleCompositeLoss()
CompositeLoss that can combine the given Loss
components.public SimpleCompositeLoss(java.lang.String name)
CompositeLoss that can combine the given Loss
components.name - the display name of the losspublic SimpleCompositeLoss addLoss(Loss loss)
loss - the loss to addprotected ai.djl.util.Pair<NDList,NDList> inputForComponent(int componentIndex, NDList labels, NDList predictions)
inputForComponent in class AbstractCompositeLosscomponentIndex - the index of the component losslabels - the label input to the composite losspredictions - the predictions input to the composite loss