← Back to Pull requests

[tmva][sofie] Implement ThresholdedRelu operator with parser and unit tests #24191

Closed
unknown closed this pull request without merging on Nov 18, 2026 12:12 UTC
View on GitHub
unknown unknown commented on Nov 17, 2026 07:03 UTC
Author

### Description
This PR implements the ONNX ThresholdedRelu activation operator in TMVA SOFIE, along with its parser ingestion and upstream unit tests.

Supersedes and replaces closed PR #24054 (as requested by @guitargeek due to inability to reopen after branch force-push). All CI issues from #24054 (clang-format, ruff, and the Linux GTest compilation issue) have been fully resolved:

  • Operator code emission now defines constexpr float op_<name>_alpha (matching ROperator_LeakyRelu), preventing the invalid digit 'f' in decimal constant compilation error under Clang/GCC on Linux.

  • C++ formatting complies strictly with ROOT .clang-format.

  • Python test model generator complies strictly with ruff format.
  • Changes Included:


    1. Operator Definition:
    - Added ROperator_ThresholdedRelu.hxx in tmva/sofie/inc/TMVA/ supporting scalar fallback emission with branchless ternary formulation:
         tensor_Y[id] = ((tensor_X[id] > op_alpha) ? tensor_X[id] : 0.0f);
         

    2. Parser Integration:
    - Added ParseThresholdedRelu.cxx in tmva/sofie_parsers/src/ to parse ONNX protobuf nodes and extract the alpha attribute (defaulting to 1.0).
    - Registered ThresholdedRelu in RModelParser_ONNX.cxx and added it to tmva/sofie_parsers/CMakeLists.txt.
    3. Tests:
    - Added make_ThresholdedRelu model generator in generate_input_models.py.
    - Added automated GTest TEST(ONNX, ThresholdedRelu) in TestCustomModelsFromONNX.cxx.

    Validation:


  • Verified end-to-end model ingestion from ONNX and C++ inference code generation locally.

  • Formatted and validated with clang-format and ruff format.
  • Diff: 208 lines (+156 / -52) across 2 files Reviewer: guitargeek Review duration: 1749m
    All Vouch review confidence checks passed
    Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 208 lines diff across 2 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.320
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #24191"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 36.4% (MEDIUM) · Higher = larger blast radius
    36.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.4% · Safe to merge
    14.4%