[tmva][sofie] Add HardSigmoid operator for ONNX inference #20933
+317
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull Request
This PR implements the
HardSigmoidoperator for the SOFIE (System for Optimized Fast Inference code Emit) engine. This is a standalone operator implementation compliant with the ONNX specification (Opset 6+).The implementation is critical for supporting MobileNetV3 architectures (also for the
HardSwishactivation).Changes or fixes:
New Operator: Implemented
TMVA::Experimental::SOFIE::ROperator_HardSigmoid.std::fmaxandstd::fminwith specific hexfloat constants (0x0p+0f,0x1p+0f) to ensure the compiler emits pure AVXMAXSS/MINSSinstructions without intermediate double-precision conversions.It Enforces
f-suffix onalphaandbetacoefficients to prevent implicit promotion todoubleduring inference.Updated
RModelParser_ONNXto correctly parsealphaandbetaattributes (defaults are set to0.2,0.5).Validation: Added a new unit test suite
TestSofieHardSigmoid.Checklist:
TestSofieHardSigmoidpassing)This PR fixes # (No specific issue linked, strictly feature addition)
cc: @guitargeek @moneta @devajithvs @bellenot