Skip to content

[tmva][sofie] Add ONNX InstanceNormalization operator#21331

Open
gluonparticle wants to merge 1 commit intoroot-project:masterfrom
gluonparticle:sofie-instance-norm
Open

[tmva][sofie] Add ONNX InstanceNormalization operator#21331
gluonparticle wants to merge 1 commit intoroot-project:masterfrom
gluonparticle:sofie-instance-norm

Conversation

@gluonparticle
Copy link
Copy Markdown

InstanceNormalization Operator for SOFIE Inference Engine

Why

InstanceNormalization is widely used in modern computer vision models (e.g., Style Transfer, GANs).
Supporting this operator in the SOFIE ONNX parser expands the range of physics-adjacent ML models that can be converted to high-performance C++.


What

  • ROperator_InstanceNormalization.hxx
    New template implementing the $N, C, H, W$ normalization logic.

  • RModelParser_ONNX.cxx
    Registered the operator and added epsilon attribute parsing.

  • test_InstanceNormalization.cxx
    Added a unit test to verify the correctness of emitted C++ code.


Testing

  • Local build verified with -Ddev=ON using GCC 15.2.1.
  • Unit test test_instancenorm passed with [SUCCESS].

@guitargeek guitargeek changed the title [TMVA][SOFIE] Add ONNX InstanceNormalization operator [tmva][sofie] Add ONNX InstanceNormalization operator Feb 23, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 25, 2026

Test Results

    21 files      21 suites   2d 23h 9m 46s ⏱️
 3 835 tests  3 833 ✅  1 💤  1 ❌
72 227 runs  72 194 ✅ 18 💤 15 ❌

For more details on these failures, see this check.

Results for commit 94047f9.

♻️ This comment has been updated with latest results.

@gluonparticle
Copy link
Copy Markdown
Author

@lmoneta I've re run the clang-format with correct flags I'd missed before.

Regarding the other CI pipeline failures (specifically on mac-beta ARM64 and ubuntu2604), looking at the logs, these appear to be existing infrastructure regressions in the PyROOT/cppyy bindings and the DistRDF Spark backends.

Please let me know if you need anything else from my end, Thanks! ;

@gluonparticle
Copy link
Copy Markdown
Author

@lmoneta @bellenot @sanjibansg Sorry to bother you again.

Please let me know if you need anything else from my side to re-run the checks and/or anything from my side on this PR.

The other failed checks (specifically on mac-beta ARM64 and ubuntu2604) appear to be existing infrastructure regressions in the PyROOT/cppyy bindings and the DistRDF Spark backends.

Thanks! ;

Copy link
Copy Markdown
Collaborator

@sanjibansg sanjibansg left a comment

Choose a reason for hiding this comment

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

Hi @gluonparticle,
Thanks for your PR on adding the implementation for the InstanceNormalization operator. I have a question regarding the test you propose to add.

Comment thread tmva/sofie/test/test_InstanceNormalization.cxx Outdated
@gluonparticle
Copy link
Copy Markdown
Author

Hi @gluonparticle, Thanks for your PR on adding the implementation for the InstanceNormalization operator. I have a question regarding the test you propose to add.

Please let me know if you need anything else from my side. Thanks! ;

@sanjibansg
Copy link
Copy Markdown
Collaborator

Hi @gluonparticle, Thanks for your PR on adding the implementation for the InstanceNormalization operator. I have a question regarding the test you propose to add.

Please let me know if you need anything else from my side. Thanks! ;

Hi @gluonparticle,
Could you look into the merge conflicts and try resolving them?

Thanks,
Sanjiban

@gluonparticle
Copy link
Copy Markdown
Author

Hi @gluonparticle, Thanks for your PR on adding the implementation for the InstanceNormalization operator. I have a question regarding the test you propose to add.

Please let me know if you need anything else from my side. Thanks! ;

Hi @gluonparticle, Could you look into the merge conflicts and try resolving them?

Thanks, Sanjiban

Hi @sanjibansg

We definitely just crossed paths like a merge conflict. I was in the middle of fixing that last remaining conflict when you commented. Everything is now fully resolved and synced with master.

I've also ran the git-clang-format wrt origin/master and clang format on the files.

Thank you for your cooperation ;

@gluonparticle
Copy link
Copy Markdown
Author

Hi @sanjibansg Could you please re-run the workflow trigger for the CI/CD checks.

Thanks for your cooperation ;

@gluonparticle
Copy link
Copy Markdown
Author

Hi @lmoneta @bellenot, Please let me know if the latest changes are ready to go for the CI run.

I've migrated the test as required and resolved all merge conflicts.

Please let me know if there's anything else I should polish from my end. Thanks! ;

@bellenot bellenot removed their request for review March 25, 2026 13:28
Copy link
Copy Markdown
Collaborator

@sanjibansg sanjibansg left a comment

Choose a reason for hiding this comment

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

I see there are still some conflicts in tmva/sofie_parsers/src/RModelParser_ONNX.cxx, could you try rebasing with the master?

@gluonparticle
Copy link
Copy Markdown
Author

I see there are still some conflicts in tmva/sofie_parsers/src/RModelParser_ONNX.cxx, could you try rebasing with the master?

Hi @sanjibansg , I've rebased and manually resolved the new conflicts along with local rebuild for the changes. Thanks! ;

Copy link
Copy Markdown
Collaborator

@sanjibansg sanjibansg left a comment

Choose a reason for hiding this comment

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

Hi @gluonparticle,
Thanks for this implementation, could of comments.

#include <unordered_map>
#include <functional>
#include "TMVA/SOFIE_common.hxx"
#include "TMVA/ROperator_InstanceNormalization.hxx"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I do not think this is where it should be included

// -----------------------------------------------------------------------------
// InstanceNormalization
// -----------------------------------------------------------------------------
std::unique_ptr<ROperator> ParseInstanceNormalization(RModelParser_ONNX & /*parser*/, const onnx::NodeProto &node)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could you follow the convention in this subdirectory on adding the parsing methods like we do in https://github.com/gluonparticle/root/blob/94047f9f573478b77d53cecd27de46481e7da7e2/tmva/sofie_parsers/src/ParseBatchNormalization.cxx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants