Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .trinity/seals/Conv2d.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"gen_hash_c": "sha256:64cc98a2d8a6874d5648322d454539821632ae913fab3dbebeb8265a4712d14f",
"gen_hash_rust": "sha256:1260822c3590b2ec7a7dc5d33d16e0db36f6b94e13bf459874fafa7339b681b1",
"gen_hash_verilog": "sha256:2e469acfecbbb53a7d0187c89ef6e8133bd185977fed689d5edd11b45a76f26c",
"gen_hash_zig": "sha256:1a8ca800f2b2cb4496acfb41062a9ef5cda7634f84034f7f6363017f924d593f",
"gen_hash_c": "sha256:60f9b428ab8ceb7d2f4654a727012c82d12eafbf92d8dde167418d5a43fe0e10",
"gen_hash_rust": "sha256:1b00b1fe570ae33bde1434d0125dc478df1d00f0470df7efb378e5dff574bb30",
"gen_hash_verilog": "sha256:83f9eae101994f85bb5be9fb7f154f01d88ff0330c3286322f584689c910b420",
"gen_hash_zig": "sha256:c1ec25dbf1daf046dfa6600b183fe3b9501525038b576582e66947e39379074f",
"module": "Conv2d",
"ring": 12,
"sealed_at": "2026-10-11T10:43:18Z",
"spec_hash": "sha256:90bf260b6fe12b6d64a323eec8c887a7ad4882d73f0307c20a240317ed64f543",
"sealed_at": "2026-10-19T01:01:23Z",
"spec_hash": "sha256:9c3e20d01e59ec8df1ae330ac9c3c27f8e67db34d524475733abaf0f3382b7f0",
"spec_path": "specs/ml/layers/conv2d_layer.t27",
"tests": {
"failed": 0,
"failing": [],
"forced": false,
"passed": 2,
"total": 2,
"passed": 14,
"total": 14,
"vacuous": 0
}
}
20 changes: 10 additions & 10 deletions .trinity/seals/layers_Conv2d.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"built_by": "t27c-bootstrap@0.5.2+cc19d1fcd",
"built_by": "t27c-bootstrap@0.5.2+239b4b059",
"closure": [
{
"spec": "specs/base/types.t27",
Expand All @@ -11,27 +11,27 @@
}
],
"config": "gen=c,rust,verilog,zig;tests=zig",
"gen_hash_c": "sha256:64cc98a2d8a6874d5648322d454539821632ae913fab3dbebeb8265a4712d14f",
"gen_hash_rust": "sha256:1260822c3590b2ec7a7dc5d33d16e0db36f6b94e13bf459874fafa7339b681b1",
"gen_hash_verilog": "sha256:2e469acfecbbb53a7d0187c89ef6e8133bd185977fed689d5edd11b45a76f26c",
"gen_hash_zig": "sha256:1a8ca800f2b2cb4496acfb41062a9ef5cda7634f84034f7f6363017f924d593f",
"gen_hash_c": "sha256:60f9b428ab8ceb7d2f4654a727012c82d12eafbf92d8dde167418d5a43fe0e10",
"gen_hash_rust": "sha256:1b00b1fe570ae33bde1434d0125dc478df1d00f0470df7efb378e5dff574bb30",
"gen_hash_verilog": "sha256:83f9eae101994f85bb5be9fb7f154f01d88ff0330c3286322f584689c910b420",
"gen_hash_zig": "sha256:c1ec25dbf1daf046dfa6600b183fe3b9501525038b576582e66947e39379074f",
"module": "Conv2d",
"ring": 12,
"seal_schema": 2,
"sealed_at": "2026-10-11T10:43:18Z",
"sealed_at": "2026-10-19T01:01:23Z",
"sealed_by": "t27c-bootstrap@0.5.2",
"spec_hash": "sha256:90bf260b6fe12b6d64a323eec8c887a7ad4882d73f0307c20a240317ed64f543",
"spec_hash": "sha256:9c3e20d01e59ec8df1ae330ac9c3c27f8e67db34d524475733abaf0f3382b7f0",
"spec_path": "specs/ml/layers/conv2d_layer.t27",
"tests": {
"failed": 0,
"failing": [],
"forced": false,
"passed": 2,
"total": 2,
"passed": 14,
"total": 14,
"vacuous": 0
},
"toolchain": {
"test_runner": "sha256:1982ae948e24d00c5d221ccec12dfce1eb01204b53e37b0f857f93b16d64629d",
"test_runner": "sha256:8512b80da533b79289110fca4a65f3336abd7a059ca4b72ea595d5e33ff8ad10",
"zig": "0.16.0"
}
}
14 changes: 14 additions & 0 deletions docs/now/2026-10-19-conv2d-slides-its-kernel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# NOW -- conv2d_layer.t27 slides its kernel, plus scalar fns for the nn-conv widget (2026-10-19)

## specs/ml/layers/conv2d_layer.t27 (Closes #10612)

- Why: `forward` multiplied one kernel-sized patch elementwise by the weights and added the bias, so the 2x2 input with the 2x2 kernel gave four numbers where a convolution gives one (3.25), and its test checked the four. No fn lowered to WASM, so course 10 lesson 10 (trinity `widgets/nn-conv`) falls back to average pooling.
- `forward` is now the deep-learning convolution (2-D cross-correlation, kernel not flipped) over one H x W channel with stride and zero padding; output side `(n + 2p - k) / s + 1`; bias once per output cell. `backward` is the sliding gradient (grad_input, grad_weights; the bias gradient is its return value, which keeps it at 8 parameters and the site compiler warning-free). Both now take `height, width`.
- Scalar entry points: `out_size(n, kernel, stride, padding)`, `conv_at(kernel_id, stride, padding, index)` on the fixed 5x5 square image with 4 fixed 3x3 kernels (identity, Sobel x, Sobel y, box blur), `kernel_at`, `image_at`, and `default_at(index)` for the old 2x2 case. `scripts/t27-logic.mjs` lowers 5 fns (`outSize`, `convAt`, `kernelAt`, `imageAt`, `defaultAt`); in node `defaultAt(0)` is 3.25 and every row of the issue's table comes back exact.
- VERSION 2 with a dated header note and a test that VERSION is 2.
- t27c (bootstrap unchanged since 239b4b059), zig 0.16.0: test-report 14 of 14 pass, 0 vacuous, 5 invariants proved. Each row of the issue's table has its own test; a 3x3 input with the 2x2 kernel pins the slide (3.6, 5.45, 9.15, 11.0).
- Negative controls: 9 mutants (elementwise fallback, stride ignored, padding ignored, kernel flipped, bias k*k times, and in backward padding ignored, kernel flipped, has_bias ignored, stride ignored), 9 killed.
- Site compiler (trinity `public/t27/t27_compiler.wasm`): typecheck ok, 0 errors, 0 discarded, all seven backends print.
- `t27c dupes --bodies` names no group in this spec (master had one: three unused `default_*` helpers with one body; removed).
- Seal saved (`Conv2d.json`, `layers_Conv2d.json`). No spec `use`s Conv2d.
- Not here: re-vendoring into trinity and switching `nn-conv/tool.js` from `pool4At` to `convAt`.
Loading
Loading