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.
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.
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.
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.
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).