Skip to content

[tmva][sofie] register Swish operator in the ONNX parser#22564

Open
harz05 wants to merge 2 commits into
root-project:masterfrom
harz05:fix/sofie-swish-parser
Open

[tmva][sofie] register Swish operator in the ONNX parser#22564
harz05 wants to merge 2 commits into
root-project:masterfrom
harz05:fix/sofie-swish-parser

Conversation

@harz05

@harz05 harz05 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Changes or fixes:

This PR registers the existing Swish operator in the ONNX parser. ROperator_Swish was implemented but never registered, so a model with the standard ONNX Swish op (opset 24) failed with "Operator type Swish is not yet supported".

I've added ParseSwish and it also reads the optional alpha attribute and rejectes when alpha!=1, since right now the op only implements alpha=1. Correspondingly "Swish" has been registered in RModelParser_ONNX.

Also added a Swish test model with reference and a test patch/

Checklist:

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

This PR fixes #22552

@harz05 harz05 requested review from bellenot and lmoneta as code owners June 10, 2026 18:22
@harz05

harz05 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

kindly review, thanks.

On a side note, I had a doubt whether we would need a clean build for this as well? Since for the last 2 PR there was some caching issue where simple build was failing. @guitargeek

@guitargeek guitargeek added clean build Ask CI to do non-incremental build on PR in:SOFIE labels Jun 11, 2026

@lmoneta lmoneta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for the PR. Interesting we add the suppot in the ROPerator but missed the parser.
Nice you included also the test.
We can maybe simplify the code, removing the template parameter in ROperator_Swish

Comment thread tmva/sofie_parsers/src/ParseSwish.cxx Outdated

std::string output_name = nodeproto.output(0);

switch (input_type) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need here to have different instantiation depending on input type?
I would drop the template type in ROperator_Swish, it is not needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review. I had kept the template following the existing activation function parsers(Sigmoid, etc.) for consistency. But you're correct, the template type isnt really used. I'll update the PR and simplfy the parser accordingly

@github-actions

Copy link
Copy Markdown

Test Results

    21 files      21 suites   3d 7h 46m 2s ⏱️
 3 863 tests  3 810 ✅   0 💤 53 ❌
72 810 runs  72 654 ✅ 103 💤 53 ❌

For more details on these failures, see this check.

Results for commit 9b903d1.

@harz05

harz05 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

i've updated the PR with the requested changes, kindly review, thanks

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

Labels

clean build Ask CI to do non-incremental build on PR in:SOFIE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[tmva][sofie] Register the existing Swish operator in the ONNX parser

3 participants