lstm_cell
std.nn.lstm_cell · Level L3One step of a long short-term memory (LSTM) cell: from the hidden state h, the cell state c and an input x, the next h and c. The four gates (input, forget, output, candidate) each take their weights from W, U and b by index. The body that lstm scans.
Signature
lstm_cell(h: f64[k], c: f64[k], x: f64[m], W: f64[4, k, k], U: f64[4, k, m], b: f64[4, k]) → f64[k], f64[k]
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
i, f, o = σ(W[g] @ h + U[g] @ x + b[g]) for g = 0, 1, 2; g = tanh(W[3] @ h + U[3] @ x + b[3]); c2 = f*c + i*g; h2 = o*tanh(c2)to 80 digits (100-digit arithmetic), on all 40 test cases. - All 332 float64 results inside the running error bound; the closest uses 12% of it.
- Interpreter and NumPy backend return bit-identical results.
- At float32 too: the 40 test cases rounded to float32, and 40 of them inside the running error bound at u = 2⁻²⁴; the closest uses 22% of it.
- correctly rounded (the float64 nearest the exact value)
- 53%
- bit-equal to the NumPy formula in float64
- 100%
- largest error, in units in the last place
- 86
Large ulp counts appear where a result is tiny next to the numbers it is computed from (after cancellation, for example), so one unit in the last place is tiny too; the absolute error is still inside the bound. Results within their own error of zero are not counted.
Identity
sha256:6ea8ce6c3bd0e71400ad10c2143bbdab325e625b3dbc686314445b44f2a3a8d2The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.
Control handle
- Symbol
- Ω:std.nn.lstm_cell · Ω:lstm_cell
- Pins
sha256:ec35b0381eabbe83ea31ec517f8d6ea1377d4d2729e3a2921ebfd7c7c3b46493this graph alone- Evidence
sha256:6b175eac05d739b4e9e47d0ccb293121ca383b8592e74e5d7f2eebc0d237cd8bthe 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.