Skip to content

[tmva][sofie] Updating BatchNormalization Op to handle paramteric input tensor - #16282

Closed
extint wants to merge 1 commit into
root-project:masterfrom
extint:BatchNormParamOp
Closed

extint wants to merge 1 commit into
root-project:masterfrom
extint:BatchNormParamOp

Conversation

@extint

@extint extint commented Aug 21, 2024

Copy link
Copy Markdown
Contributor

This Pull request:

Updates the implementation of BatchNormalization Operator to parse input tensors with parametric shapes.

  • x input tensor can have shapes of form {dim1, dim2, dim3}
  • scale, B, input_mean, input_var tensors need to be initialized tensors

ONNX Documentation

Changes or fixes:

  • Updated implementation in the ROperator_BatchNormalization.hxx file to handle parametric shapes.

Checklist:

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

This PR fixes #

@guitargeek

Copy link
Copy Markdown
Contributor

Hi @extint, thanks a lot for this contribution, and sorry it sat open for so long.

In the meantime, parametric/dynamic input-tensor support for BatchNormalization landed on master independently, so this PR is now superseded:

  • 1c6fd66: [tmva][sofie] Add support for Dynamic tensors in more operators added the equivalent functionality via SOFIE's standard Dim-based API (fShapeX -> std::vector<Dim>, model.GetDimTensorShape(), broadcast guarded by model.IsDynamicTensor()).
  • [tmva][sofie] Optimized performance and memory usage of BatchNorm #19633: [tmva][sofie] Optimized performance and memory usage of BatchNorm then rewrote the codegen, handling the parametric case without explicit runtime broadcasting.

Since the operator has been rewritten and this branch can no longer rebase cleanly (it also relies on helpers that were since removed), I'll close it as superseded. Your work was a useful early step in that direction.

Thanks again, and we'd be glad to see you contribute in the future! 🙂

@guitargeek guitargeek closed this Jun 19, 2026
Pranav-error added a commit to Pranav-error/scientific-ml-pipelines that referenced this pull request Aug 21, 2026
Corrects 53100a4's 10/11. That run's BatchNorm codegen failure was a second test artifact,
not a SOFIE bug: a freshly initialised BatchNorm has weight == running_var and
bias == running_mean, so the ONNX exporter deduplicates them behind Identity nodes, and
SOFIE requires scale/B/mean/var to be initialized tensors (root-project/root#16282). With
distinct parameter values, as any trained model has, the export contains all four
initializers, no Identity nodes, and codegen succeeds. Nothing to report upstream.

PyTorch parser stays at 2/11, matching RModelParser_PyTorch.cxx exactly. That gap was
already reported as root-project/root#23108 and closed NOT_PLANNED: the parser is orphaned
and #22734 removes it in favour of PyTorch's own ONNX export. The 11/11 ONNX column is the
evidence that the removal costs users nothing.

Also link both upstream issues from the README, so the operator counts and the decision
that followed them are traceable rather than asserted.

Co-Authored-By: Claude Opus 5 <[email protected]>
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.

3 participants