Skip to content

[sparsepixels] support asymmetric pool sizes in sparsepixels sparse pooling - #1522

Merged
JanFSchulte merged 2 commits into
fastmachinelearning:mainfrom
hftsoi:sparsepixels-asym-pool
Aug 11, 2026
Merged

[sparsepixels] support asymmetric pool sizes in sparsepixels sparse pooling#1522
JanFSchulte merged 2 commits into
fastmachinelearning:mainfrom
hftsoi:sparsepixels-asym-pool

Conversation

@hftsoi

@hftsoi hftsoi commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

For sparsepixels models, the current sparse pooling assumes square pool size only, this PR adds support for asymmetric pool sizes. It is tested ok with new models converted and synthesized. Like before, it does not touch anything outside the sparsepixels module. New test added to pytest for this.

@JanFSchulte JanFSchulte added enhancement please test Trigger testing by creating local PR branch labels Aug 10, 2026
// features zeroed, matching the dense layer dropping that window; zero-feature pixels are inert in
// every downstream sparse kernel. The averaging divides by the full pool area as one reciprocal
// multiply per axis (skipped for a unit axis, whose reciprocal 1.0 the fixed-point type cannot
// hold); for square pools this reproduces the previous two-multiply arithmetic exactly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove mentions of a "previous version", this will be meaningless for anyone reading the code in the future.

constexpr int out_height = in_height / pool_height;
constexpr int out_width = in_width / pool_width;
// Unsigned reciprocals: 1/2 = 0.5 needs the unsigned [0, 1) range (signed ap_fixed<10,0> tops
// out just below 0.5 and would wrap). Truncation at 10 fractional bits matches the previous

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, don't compare to any previous implementations, just describing what the current code does is sufficient.

@JanFSchulte JanFSchulte added please test Trigger testing by creating local PR branch and removed please test Trigger testing by creating local PR branch labels Aug 10, 2026
@JanFSchulte
JanFSchulte merged commit 8bafebd into fastmachinelearning:main Aug 11, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement please test Trigger testing by creating local PR branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants