public compute(outputs as NDArray<T>, targets as NDArray<Targets>, gradientScale as Double = 1.0) as LossResult<T>
Computes mean loss and its derivative without changing either input.
| Parameter | Description |
|---|---|
outputs | Batched model outputs. |
targets | Supervision in the objective's statically declared type. |
gradientScale | Positive finite derivative multiplier; loss is unscaled. |
Mean scalar objective and a gradient shaped like outputs.
result = loss.compute(predictions, targets, 1.0)