mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-07 12:13:22 +00:00
* SAM 2 mask decoder: transposed convolutions as matrix product plus pixel shuffle (#3031) Both transposed convolutions of the mask decoder have a 2x2 kernel, stride 2 and no padding, so each input pixel owns its own 2x2 output block. That is one matrix product plus a pixel shuffle, which is about twice as fast on the CPU as candle's conv_transpose2d. The first convolution also takes the decoder's key tokens directly, without the transpose and copy to an image. The candle path stays in the code for the tests. They compare the two to 1e-6 (relative to the largest output value) on the decoder's real sizes, odd and degenerate sizes, large values, zeros and a single hot pixel, check that other kernels are refused, and compare a whole decoder forward pass (single and multi mask) on random weights. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * SAM 2 decoder test: bound the weight discovery loop Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>