cross_entropy_labels
std.loss.cross_entropy_labels · Level L3Softmax cross-entropy over rows of logits with integer labels, the way classifiers are trained: a stable log-softmax per row, then nll_labels.
−(1/n)·Σᵢ (zᵢ,yᵢ − log Σⱼ e^zᵢⱼ)
Signature
cross_entropy_labels(logits: f64[n, c], labels: i64[n]) → f64[]
Structure
The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.
- input
- operation
- constant
- call
- output
Verification
- Signature proven by NOVA’s shape solver, for every size.
- Agrees with the reference
mean over rows of (logsumexp(z_i) - z_i[y_i])to 80 digits (100-digit arithmetic), on all 40 test cases. - All 40 float64 results inside the running error bound; the closest uses 12% of it.
- Interpreter and NumPy backend return bit-identical results.
Accuracy in detail
- correctly rounded (the float64 nearest the exact value)
- 73%
- bit-equal to the NumPy formula in float64
- 90%
- largest error, in units in the last place
- 1.24
Identity
sha256:eeaceb8338df67d67eea7403d51707ffbb1c5cfab1cc0697c6f418235d7f1479The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.