Skip to content

[tmva][sofie] throw on invalid BatchNormalization input count#21773

Merged
guitargeek merged 1 commit intoroot-project:masterfrom
harz05:fix/sofie-batchnorm-invalid-input-count
Apr 10, 2026
Merged

[tmva][sofie] throw on invalid BatchNormalization input count#21773
guitargeek merged 1 commit intoroot-project:masterfrom
harz05:fix/sofie-batchnorm-invalid-input-count

Conversation

@harz05
Copy link
Copy Markdown
Contributor

@harz05 harz05 commented Apr 2, 2026

Changes:

ParseBatchNormalization only constructed the operator when input_size() == 5 but had no else clause, so nodes with fewer inputs silently returned a null unique_ptr and crashed later in Generate() with an unrelated error message.

I've simply added an else throw to reject invalid input counts immediately at parse time with a clear error message, consistent with other parsers in the codebase.

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR fixes #21759

@harz05 harz05 requested a review from lmoneta as a code owner April 2, 2026 10:11
@harz05
Copy link
Copy Markdown
Contributor Author

harz05 commented Apr 2, 2026

I'd also like to add a regression test for this(verifying Parse() throws std::runtime_error) but im not sure what's the best to add it.
TestCustomModelsFromONNX.cxx doesn't currently link against ROOTTMVASofieParser and placing an invalid .onnx in input_models/ would break the emitFromONNX fixture.
@guitargeek

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

Test Results

    22 files      22 suites   3d 5h 19m 29s ⏱️
 3 836 tests  3 835 ✅  1 💤 0 ❌
75 716 runs  75 698 ✅ 18 💤 0 ❌

Results for commit 6141a69.

Copy link
Copy Markdown
Contributor

@guitargeek guitargeek left a comment

Choose a reason for hiding this comment

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

Thanks! I don't think we need a regression test here, as this doesn't fix a bug per se but is more a usability improvement 👍

@guitargeek guitargeek merged commit 18a86f0 into root-project:master Apr 10, 2026
33 checks passed
@harz05
Copy link
Copy Markdown
Contributor Author

harz05 commented Apr 10, 2026

Thanks! I don't think we need a regression test here, as this doesn't fix a bug per se but is more a usability improvement 👍

Thanks for the review and merge!

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.

[tmva][sofie] ParseBatchNormalization accepts invalid input count and fails late

3 participants