-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[C++] fix type inconsistent issue when loading quantized parameters #15038
[C++] fix type inconsistent issue when loading quantized parameters #15038
Conversation
@reminisce @ZhennanQin could you help take a review? |
I wrote a simple test to reproduce this issue.
Before
After
|
Please add a test case for the change |
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.
LGTM
@mxnet-label-bot add [C++, NDArray, pr-awaiting-response] |
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.
LGTM.
@wuxun-zhang Please also post the error log before this fix. |
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.
The code changes look good to me now. @szha @eric-haibin-lin can you take a look at the cpp API change?
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.
LGTM
Thanks for your contribution. Merged :) |
…pache#15038) * fix type inconsistent when using C++ API to load params file * add test case * fix cpplint * address comment * retrigger CI * fix comments * modify ci_test * fix indentation
Description
@pengzhao-intel @ZhennanQin
We want to use inception_inference.cpp to do inference with quantized models. But When I tried to run inference, there always have a type inconsistent error. We found that during loading parameters, new NDArrays will be created with default data type (float32) and copy the original NDArray to this new NDArray by using NDArray.Copy(context). So, the original int8 params will be converted into float32 params and this will raise the type inconsistent issue.
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
Comments