Skip to content
Snippets Groups Projects

feat: Add missing operators for AIDGE model benchmarking

Merged Gallas Gaye requested to merge gallasko/aidge_export_cpp:benchmark_operator into dev

Context

I am working on benchmarking AIDGE models by fully creating them in AIDGE, setting their weights randomly, and exporting them to C++. The goal is to verify if the outputs in C++ match the forward pass results in AIDGE. You can find it here

To achieve this, I have added several missing operators necessary for running models such as:

  • SqueezeNet
  • ResNet18 / ResNet50
  • MLP for MNIST
  • MobileNet

These operators are now available in the export pipeline to ensure proper benchmarking.

Modified Files

  • Operators & Kernels

    • aidge_export_cpp/kernels/batchnorm.hpp: Added missing batch normalization operator.
    • aidge_export_cpp/kernels/concat.hpp: Added concatenation operator.
    • aidge_export_cpp/kernels/pad.hpp: Added padding operator.
    • aidge_export_cpp/kernels/pooling.hpp: Added AvgPooling2D.
    • aidge_export_cpp/kernels/softmax.hpp: Added softmax operator.
  • Python Script

    • aidge_export_cpp/operators.py: Updated operator handling to include new additions.
  • Configuration Templates

    • aidge_export_cpp/templates/configuration/*: Added configurations for batchnorm, concat, pad, and softmax.
  • Kernel Forward Templates

    • aidge_export_cpp/templates/kernel_forward/*: Added missing forward implementations for batchnorm, concat, pad, and softmax.
  • Unit Tests

    • aidge_export_cpp/unit_tests/test_export.py: Updated tests to validate newly added operators.

Detailed Major Modifications

  • Implemented missing operators to support model export and validation in C++.
  • Ensured each new operator follows the existing API.
  • Updated test cases to validate correctness of the exported model execution.
  • Added the possibility of setting the weights inside the model randomly or with a default value to stay deterministic for the unit tests

TODO

  • Add some of the missing args of Pad2D. Do add assertion for now that attribute for padding is constant fill (i.e.do not support other attributes such as mirror etc...).
Edited by Gallas Gaye

Merge request reports

Merge request pipeline #70781 passed

Merge request pipeline passed for 838ac45d

Test coverage 63.00% from 1 job
Approved by
Code Quality is loading
Test summary results are being parsed

Merged by Axel FarrugiaAxel Farrugia 2 months ago (Apr 17, 2025 2:42pm UTC)

Merge details

  • Changes merged into dev with e8b1c141.
  • Deleted the source branch.

Pipeline #71076 failed

Pipeline failed for e8b1c141 on dev

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Christophe Guillon
  • Christophe Guillon
  • See review for softmax commit

  • changed milestone to %aidge v0.6.0

  • Christophe Guillon
  • Maxence Naud
  • Christophe Guillon
  • Christophe Guillon
  • Ref review for concat

  • Christophe Guillon
  • Christophe Guillon
  • Christophe Guillon
  • Christophe Guillon
  • Some issues with batch on HW / WH indexing.

    Please for the unit tests, add a non-1 batch dimension and use non square HW, i.e. set H != W.

  • Christophe Guillon
  • Christophe Guillon
  • Christophe Guillon
  • Christophe Guillon
  • Christophe Guillon
  • Christophe Guillon
  • Gallas Gaye added 10 commits

    added 10 commits

    • 7d5b8ce3 - feat: Added Batchnorm2d export op
    • 3136f3c2 - feat: Added Concat export op
    • a298e118 - feat: Added Pad2d export op
    • 4a0dbb6f - feat: Added more tests
    • 2c410ef5 - fix: Better control over random number generation
    • b2dbf4da - fix: Some unit test failing
    • a4c4b922 - fix: Only allow possitive value of variances in batchnorm
    • c0763c37 - feat: Added AvgPooling2D export op
    • 1bac314b - Pad works for with size mismatch
    • 0b984f82 - Pad works now for all size of batch and rectangular aspects

    Compare with previous version

  • @mnewson FYI. Btw it may be worth adding your ConvNeXt model to the aidge_benchmark at a later date...

  • Gallas Gaye added 3 commits

    added 3 commits

    • c9893d2b - Renamed correctly pad forward
    • 158b1569 - Fix average pooling
    • 4285dbc9 - Added more test cases to the test suite

    Compare with previous version

  • Gallas Gaye added 5 commits

    added 5 commits

    • d0d6193c - Added more ut for batchnorm
    • 6b00b5cc - fixed indentation in pad
    • 116bb0c1 - Fix batchnorm with denser input
    • 2131467a - Assert if concat is done on anorther axis than 1
    • 937b8fe6 - Pass on softmax op

    Compare with previous version

  • Christophe Guillon
  • Christophe Guillon
  • Christophe Guillon
  • Christophe Guillon
  • Christophe Guillon
  • Christophe Guillon
  • Christophe Guillon
  • Christophe Guillon
  • Cyril Moineau mentioned in merge request !33 (closed)

    mentioned in merge request !33 (closed)

  • changed milestone to %aidge v0.7.0

  • mentioned in merge request aidge_core!403 (merged)

  • Gallas Gaye added 6 commits

    added 6 commits

    • 12e07914 - feat: Added AvgPooling2D export op
    • ef1ccd8b - fix: Better pad op implementation
    • 8291303d - feat: Added more test cases to the test suite
    • 3eacad44 - fix: Batch support for batchnorm
    • 5dfeac42 - feat: Softmax works with any number of dimensions
    • efa5e9bb - feat: Concat works for any axis

    Compare with previous version

  • Christophe Guillon resolved all threads

    resolved all threads

  • Christophe Guillon
  • Gallas Gaye added 21 commits

    added 21 commits

    • efa5e9bb...da88eb0f - 11 earlier commits
    • 3d6707b0 - feat: Added more tests
    • 939fdfc4 - fix: Better control over random number generation
    • 6612538a - fix: Some unit test failing
    • 9c5d3b0b - fix: Only allow possitive value of variances in batchnorm
    • eefac137 - feat: Added AvgPooling2D export op
    • 649a27e8 - fix: Better pad op implementation
    • 52475cd1 - feat: Added more test cases to the test suite
    • fb5ebdb2 - fix: Batch support for batchnorm
    • 0cb91a4e - feat: Softmax works with any number of dimensions
    • 520cabd6 - feat: Concat works for any axis

    Compare with previous version

  • Gallas Gaye added 4 commits

    added 4 commits

    • 5ec88a78 - feat: Added more test cases to the test suite
    • c436eeb7 - fix: Batch support for batchnorm
    • 2f808fe9 - feat: Softmax works with any number of dimensions
    • e63fdee8 - feat: Concat works for any axis

    Compare with previous version

  • Gallas Gaye added 26 commits

    added 26 commits

    • e63fdee8...6a5441df - 12 commits from branch eclipse/aidge:dev
    • 6a5441df...1044a6b6 - 4 earlier commits
    • 8f3170bf - feat: Added more tests
    • 1aecd6c3 - fix: Better control over random number generation
    • 0ee3b761 - fix: Some unit test failing
    • 90f53c3d - fix: Only allow possitive value of variances in batchnorm
    • f4815323 - feat: Added AvgPooling2D export op
    • 8c84b470 - fix: Better pad op implementation
    • d521dbed - feat: Added more test cases to the test suite
    • d6064e31 - fix: Batch support for batchnorm
    • 141e7c3e - feat: Softmax works with any number of dimensions
    • 0f32cc6d - feat: Concat works for any axis

    Compare with previous version

  • Christophe Guillon resolved all threads

    resolved all threads

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading