-
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 hardSwish #32
Conversation
@fdwr Please also help review this PR, thanks. |
4.453125, -4.453125, -6.875, 0.78125, 0.859375, | ||
]; | ||
const expectedData = [ | ||
4.53125, 3.90625, 3.046875, -0.0, -0.3700764973958333, |
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.
Interesting that math.Max(0, -8)
returns -0 instead of 0, but it should make no difference either way. (no change requested)
function testHardSwish(input, expected) { | ||
const inputTensor = new Tensor(input.shape, input.value); | ||
const outputTensor = hardSwish(inputTensor); | ||
utils.checkValue(outputTensor, expected); |
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.
Where's the 4 ULP value? (webmachinelearning/webnn#338 (comment)) It appears checkValue(tensor, expected, nulp = 0)
defaults to zero in https://github.com/webmachinelearning/webnn-baseline/blob/main/test/utils.js.
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.
Where's the 4 ULP value?
This result data computed by pure JavaScript is for baseline data, so it's 0 ULP
here .
And 4 ULP
is the tolerance for the results computed by WebNN API comparing with baseline data, this 4 ULP
is used by WPT hardSwish
tests.
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.
Okie dokie 👍.
fix #11
@huningxin Please review implementation and tests of hardSwish , thanks.
Two new tests of hardSwish were referred to NNAPI CTS tests of HARD_SWISH using their input data. The expected data of -0.0 having signed flag are different from native ones 0.0, since JavaScript has signed zeroes which implements the IEEE Standard for Floating-Point Arithmetic (IEEE 754).