Repository navigation
Frame generation: net1's delivered wiring and arithmetic in the CPU reference - #181
Merged
Merged
Conversation
…eference clean/fg/reference/net1.py runs net1 end to end as delivered: the 2x2 fold (channel 4v + q), 32 steps as data (five levels down with 2x2 max-pool, the bottom, five levels up with an align-corners upscale and a float16 skip add), zero border, leaky ReLU with the delivered slope (0x211E) after every convolution but the last, and float16 accumulation from the bias in 16-term chunks in each layer's chunk order. clean/fg/reference/fp16acc.py does the chunk accumulation exactly with integer arithmetic. forward.net1_forward(values, params) takes no other arguments now; net2 keeps its required wiring and border rule. Parameters can also come from the converter's model file; tools/net1_digest.py records the digest of net1's output for a fixed synthetic input. Refs #96 Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds net1's delivered wiring and arithmetic to the CPU reference (lane h). net1, the 17-blob U-Net, is now complete and needs no required arguments; net2 keeps its required wiring until its own wiring is delivered. This PR stacks on #180 (map v1.1, natural weights); after #180 merges, its base becomes main.
clean/fg/reference/net1.py(all fixed, nothing an argument)4v + qwithq = 2dy + dx. Channels 40–47 and pixels outside the input are zero. The 16 output channels per cell unfold the same way to 4 values per pixel.NET1_WIRING: the 32 steps as data. Five levels down (convolution, then 2×2 max-pool), the two bottom 1×1 convolutions, then five levels up (upscale to the skip's size, float16 add of the skip, two 1×1 convolutions). Level sizes halve with floor.y = max(x, h(s·x))after every convolution except the last, with the delivered slopes = 0.0099945068359375(float160x211E).m ← (x > m)·x + (x ≤ m)·m, in float16.clean/fg/reference/fp16acc.py: the exact chunk accumulation,RN16(acc + Σ₁₆ aᵢbᵢ), in integer arithmetic (high/low splits of the 2⁻²⁴ integer form, then one nearest-even rounding). Non-finite operands follow IEEE.forward.pynet1_forward(values, params)takes no other arguments.params_from_model_fileandread_model_fileread the converter'smodel.wgcm(container version 1, checksum checked).run_graph/net2_forwardwith a required wiring and border rule.clean/fg/tools/net1_digest.py: runs net1 on a converter model file with a fixed synthetic input (seeded, 64×64 pixels) and records digests only: the output's SHA-256, its shape, the non-finite count and the model file's SHA-256.Notes
0x211F). The delivered value0x211Eis used as given.Refs #96
Tested
test_fg_fp16acc: about 2,100 random rows (every exponent, subnormals, large values) plus ties, sticky bits, cancellation to ±0 and overflow, against an exactFractionreference written in the test.test_fg_net1, against versions written separately in the test:model.wgcmwritten by the test.clean/fgset passes (73 tests).clean/fg.Not tested