Support GlobalAveragePool#270
Open
npow wants to merge 1 commit into
Open
Conversation
Add GlobalAvgPool2D struct to pooling.rs with forward pass (op) and ZK proof (prove_globalavgpool / verify_globalavgpool) using sumcheck. Add PoolKind enum to PoolingCtx; refactor PoolingProof into enum with MaxPool and GlobalAvgPool variants. Update layers/mod.rs to handle the new PoolingProof enum. Register 'Reduce<Sum>' in the ONNX parser (load_globalavgpool) so tract-expanded GlobalAveragePool ops are parsed correctly; update parse_node to prefer longest-matching key (GlobalAveragePool > Pool) and fall back to matching by op type name. Add tiny_avgpool.onnx test fixture and parser unit test. All 146 lib tests pass (5 pre-existing GPT-2 model file failures unchanged). Also fixes pre-existing clippy lint: mem::replace -> mem::take in prover.rs.
nikkolasg
pushed a commit
that referenced
this pull request
May 31, 2026
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.
Most modern classifiers (ResNet, EfficientNet, ViT) end in a global average pool, which the parser currently rejects.
GlobalAvgPool2Dinlayers/pooling.rsalongsideMaxPool, with a sumcheck proof.PoolingProofbecomes an enum (MaxPool,GlobalAvgPool) to keep the existing prover/verifier dispatch the same shape.tractlowers ONNXGlobalAveragePooltoReduce<Sum>followed by aMulnormalizer, so the parser consumes both nodes and returns theMul's id.Also flipped a
mem::replacetomem::takeinprover.rswhile I was in there.