-
Notifications
You must be signed in to change notification settings - Fork 8
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
Implement quantizeLinear #101
Implement quantizeLinear #101
Conversation
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.
Small comments, else LGTM. 🫡
src/quantize_linear.js
Outdated
const addOutput = add(div(input, scale), zeroPoint); | ||
const roundOutput = unary(addOutput, (x) => roundToNearestEvens(x)); |
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.
const addOutput = add(div(input, scale), zeroPoint); | |
const roundOutput = unary(addOutput, (x) => roundToNearestEvens(x)); | |
const dividedOutput = div(input, scale); | |
const roundedOutput = unary(dividedOutput, (x) => roundToNearestEvens(x)); | |
const addedOutput = add(roundedOutput, zeroPoint); |
Round before adding.
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.
Updated, thanks.
} | ||
|
||
it('quantizeLinear 1D to uint8 broadcasting scale and zeroPoint', function() { | ||
testQuantizeLinear( |
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.
A 0D case would complete the set.
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.
Done, thanks.
f470ae0
to
2e7bfd3
Compare
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.
@fdwr I've submitted new commit, please take another look, thanks.
} | ||
|
||
it('quantizeLinear 1D to uint8 broadcasting scale and zeroPoint', function() { | ||
testQuantizeLinear( |
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.
Done, thanks.
src/quantize_linear.js
Outdated
const addOutput = add(div(input, scale), zeroPoint); | ||
const roundOutput = unary(addOutput, (x) => roundToNearestEvens(x)); |
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.
Updated, thanks.
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.
👍
@huningxin @fdwr @lisa0314 PTAL, thanks.