Skip to content

Frame generation: converter map revision v1.1 (natural order); the CPU reference on natural weights - #180

Merged
phantoslayer21 merged 3 commits into
mainfrom
fg/map-v1.1
Nov 14, 2026
Merged

phantoslayer21 merged 3 commits into
mainfrom
fg/map-v1.1

Conversation

@phantoslayer21

Copy link
Copy Markdown
Owner

Moves frame generation to the spec side's converter map revision v1.1, which gives the weights in natural order, and moves the CPU reference onto natural weights (lane h).

Map

  • data/fg.v1.map.json now holds revision v1.1, byte for byte, keeping its name as preset-L.v1.map.json did for its v1.1.
    • Same sources, stages and biases as v1.
    • Every weight tensor W is now in natural order: [out, in, 3, 3] for 3×3 layers and [out, in] for 1×1 layers, with every axis given by explicit offsets. "channel_order": "natural".
  • The new SHA-256 (b32d9195…c7ad5) is pinned in the converter tests and in clean/fg/tests/test_fg_map.py.
  • The converter needed no change: Converter: the delivered preset-FG map, storage order and offset axes #177 already supports offset axes. "channel_order": "storage" (v1's form) is still accepted for preset FG and stays tested.

CPU reference

  • New clean/fg/reference/natural.py: takes the natural order from the map's own offsets. It turns stored blob weights into natural ones and natural into the reference's canonical [out, k, k, in]. The storage order is never restated in code.
  • forward.py uses natural weights. params_from_blobs puts stored weights in natural order through the map, and params_from_raw reads the converter's W/b. weight_view and blob2 are no longer arguments.
    • net1's blob 2 is a 1×1 convolution.
    • net2's first layer stores 16 input channels and reads 10, so its natural weights are [32, 10, 3, 3].
  • Still required arguments: wiring, pad, fold_order.
  • layout.py (blob 2: 1×1), ops.weight_shape (the used input count) and FORMATS.md (the weight-order and blob-2 items closed) are updated to match.

Refs #96

Tested

  • clean/fg unit tests all pass locally (55+). New test_fg_natural:
    • every weight gather covers its stored span without repeats; it is a permutation for every layer except net2's layer 1, which reads 10 of 16 inputs;
    • natural shapes and bias indices against the layout;
    • natural weights scattered into synthetic blobs with the map's gathers come back unchanged through blobs.split_all and the natural view, for every layer.
  • test_fg_forward (every layer against a direct NumPy convolution, stand-in wirings, raw parameters) runs on natural weights.
  • Converter end-to-end tests in quick mode (3,621 checks) pass on the v1.1 layout. They include the zero-area/bias NaN guards, the storage form, missing blobs and malformed offsets. The converter source is unchanged.
  • The real-file check was re-run on v1.1 with clean/fg/tools/real_check.py (execute-only, the same player library as before) and passed. The record holds digests only and stays private.
  • The line-ending check and the public gates pass, with no hits in the changed files.

Not tested

  • The original's network output: the wiring and the float16 accumulation order are still not delivered.

…U reference on natural weights

data/fg.v1.map.json is now the spec side's revision v1.1: every weight tensor W in
natural order ([out, in, 3, 3] / [out, in]) by explicit offsets, channel_order
natural; digest pinned again in the converter tests and clean/fg/tests/test_fg_map.py.

clean/fg/reference/natural.py takes the natural order from the map's own offsets
(stored blob weights to natural, natural to canonical). The forward reference now
uses natural weights: weight_view and blob2 are no longer arguments (blob 2 is a
1x1 convolution; net2's first layer reads 10 of its 16 stored inputs). FORMATS.md
closes the weight-order and blob-2 items.

Refs #96

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
@phantoslayer21
phantoslayer21 marked this pull request as ready for review November 14, 2026 17:50
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
@phantoslayer21
phantoslayer21 merged commit d155d81 into main Nov 14, 2026
9 checks passed
@phantoslayer21
phantoslayer21 deleted the fg/map-v1.1 branch November 14, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant