CARVIEW |
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
Support ONNX operator QLinearSoftmax in dnn #23655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
TEST_P(Test_ONNX_layers, QLinearSoftmax) | ||
{ | ||
// threshold is set for fusion with dequantization | ||
testONNXModels("qlinearsoftmax_11", npy, 0.001, 0.002); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this test cover all 4 scenarios?
SoftmaxInt8Invoker<true>::run(src, dst, blobs[0], N, D, output_sc, output_zp);
SoftmaxInt8Invoker<false>::run(src, dst, blobs[0], N, D, output_sc, output_zp);
SoftmaxInt8OutputFloatInvoker<true>::run(src, dst, blobs[0], N, D);
SoftmaxInt8OutputFloatInvoker<false>::run(src, dst, blobs[0], N, D);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test does not cover log softmax, but it is tested by the existing test Test_Int8_layers.Softmax_log_ONNX/0
instead.
The model architecture of this test is like [input]->QuantizeLinear -> QLinearSoftmax -> DequantizeLinear -> [output]
. Since we have tryFuse
in SoftmaxInt8
which fuses DequantizeLinear
and therefore we have output in float instead of int8 in the end, SoftmaxInt8OutputFloatInvoker<false>::run(...)
is triggered here in the test. I tested locally with tryFuse
disabled which triggers SoftmaxInt8Invoker<false>::run(...)
and it passes. Do you think it necessary to add another test case for int8 output like [input] -> QLinearSoftmax -> [output]
?
All todo items are clear. Please review if possible. |
Support ONNX operator QLinearSoftmax in dnn opencv#23655 Resolves opencv#23636. Merge with opencv/opencv_extra#1064. This PR maps the QLinearSoftmax (from com.microsoft domain) to SoftmaxInt8 in dnn along with some speed optimization. Todo: - [x] support QLinearSoftmax with opset = 13 - [x] add model and test data for QLinearSoftmax with opset = 13 - [x] ensure all models have dims >= 3. - [x] add the script to generate model and test data ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
Support ONNX operator QLinearSoftmax in dnn opencv#23655 Resolves opencv#23636. Merge with opencv/opencv_extra#1064. This PR maps the QLinearSoftmax (from com.microsoft domain) to SoftmaxInt8 in dnn along with some speed optimization. Todo: - [x] support QLinearSoftmax with opset = 13 - [x] add model and test data for QLinearSoftmax with opset = 13 - [x] ensure all models have dims >= 3. - [x] add the script to generate model and test data ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
Resolves #23636.
Merge with opencv/opencv_extra#1064.
This PR maps the QLinearSoftmax (from com.microsoft domain) to SoftmaxInt8 in dnn along with some speed optimization.
Todo:
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.