bce_with_logits
std.loss.bce_with_logits · Level L5Binary cross-entropy taken from logits: max(z, 0) − z·t + log1p(e^(−|z|)). It never forms the probability, so it stays finite and accurate where sigmoid would round to 0 or 1.
Signature
bce_with_logits(z: f64[n], t: f64[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(t·log(1 + e^(−z)) + (1 − t)·log(1 + e^z))to 80 digits (100-digit arithmetic), on all 40 test cases. - All 40 float64 results inside the running error bound; the closest uses 21% of it.
- Interpreter and NumPy backend return bit-identical results.
- correctly rounded (the float64 nearest the exact value)
- 78%
- bit-equal to the NumPy formula in float64
- 60%
- largest error, in units in the last place
- 1.53
Note
The reference is −t·log σ(z) − (1 − t)·log(1 − σ(z)) with each log written out as log(1 + e^(∓z)), in exact arithmetic: no 1 − σ is ever formed, so nothing cancels even at 100 digits.
Identity
sha256:f468daa04419c960dc91c9f134e0c909c0ca6f6b1ab07e0590d42ed1f04b65ecThe semantic hash of the graph. It changes when the program changes, and never when only its documentation does.
Control handle
- Symbol
- Ω:std.loss.bce_with_logits · Ω:bce_with_logits
- Pins
sha256:3b35b3c71353c49893178b8e6f3c62feaec4744f764264190040d89e8c31afa7this graph and the 1 it reaches through calls- Evidence
sha256:4dd15bd2469dae012f5e396fcc9bb48f2e018966426e81f6418354610a3ad208the hash of its verification record- Needs
- no capability: a pure function
Through NOVA’s control layer, the symbol launches this function only while the program still matches what it pins: a change to this graph, or to any graph it reaches, needs a migration first.