klyn.math.nn.losses.SparseCategoricalCrossentropy.SparseCategoricalCrossentropy
constructor
public SparseCategoricalCrossentropy(fromLogits as Boolean = true)
Description

Selects stable log-sum-exp mode or probability mode. Probability mode validates each row sum and clips target probabilities below 1e-7 before the logarithm; the derivative of that clipped region is zero. Logit mode avoids this saturation for very confidently wrong scores.

Parameters
ParameterDescription
fromLogitsTrue for a linear output; false after Softmax.
Example

loss = SparseCategoricalCrossentropy<Float>(fromLogits=false)