LossResult
classin packageklyn.math.nn.losses
public class LossResult<T extends AbstractFloat = Float>
LossResult

A mean batch loss and its derivative with respect to model outputs.

Example

result = SparseCategoricalCrossentropy<Float>().compute(logits, labels)

Properties
Modifier and Type Member Description
public readonly property gradient
gradient as NDArray<T>
Mean-reduced output gradient, including an optional loss-scaling factor.
public readonly property value
value as Double
Mean scalar loss accumulated in FP64.
Constructors
Modifier and Type Member Description
public LossResult
LossResult(value as Double, gradient as NDArray<T>)
Retains a scalar loss and its gradient without copying the array.