Open BruceDai opened 1 year ago
Link to #265
Operator tolerances:
Op | float16 | float32 | notes |
---|---|---|---|
elu | 18 ULP | 18 ULP | if a >= 0 then a else (expₑ(a) - 1) * alpha |
hardSwish | 4 ULP | 4 ULP | if x <= -threshold then 0 elif x >= threshold else x (x + threshold) / (2 threshold) // threshold = 3 |
gru | ? ULP | ? ULP | ⏳ |
gruCell | ? ULP | ? ULP | ⏳ |
hardSigmoid | 2 ULP | 2 ULP | clamp(a * alpha + beta, 0, 1)); defaults alpha = 0.2, beta = 0.5 |
instanceNormalization | ? ULP | ? ULP | ⏳ (a - mean) * scale / sqrt(variance + epsilon) + bias ¹ |
linear | 2 ULP | 2 ULP | x * scale + bias |
lstm | ? ULP | ? ULP | ⏳ |
lstmCell | ? ULP | ? ULP | ⏳ |
l2Pool2d | IEPOE * 2 + 1 ULP | IEPOE * 2 + 1 ULP | sqrt(a0^2 + a1^2 + … + an^2) |
pad | 0 ULP | 0 ULP | should be exact, no math |
prelu | 1 ULP | 1 ULP | if a >= 0 then a else a * slope |
reduceL1 | <=IEPOE ULP | <=IEPOE ULP | abs(x1) + abs(x2) + ... + abs(xn) |
reduceL2 | IEPOE * 2 + 1 ULP | IEPOE * 2 + 1 ULP | sqrt(a1^2 + a2^2 + ... + an^2) |
reduceLogSum | IEPOE + 18 ULP | IEPOE + 18 ULP | log(a1 + a2 + ... + an) |
reduceLogSumExp | IEPOE*2 + 18 ULP | IEPOE*2 + 18 ULP | log(exp(a1) + exp(a2) + ... + exp(an)) |
reduceSumSquare | IEPOE * 2 ULP | IEPOE * 2 ULP | a1^2 + a2^2 + ... + an^2 |
resample2d | ? ULP | ? ULP | ⏳ |
softplus | 18 ULP | 18 ULP | logₑ(1 + expₑ(a)) |
softsign | 3 ULP | 3 ULP | x / (1 + abs(a)) |
Earlier ones here: https://github.com/webmachinelearning/webnn/issues/265#issuecomment-1256242643
¹ "Instance" normalization is really spatial normalization, where the spatial channels are reduced and normalized, while batch and channel remain independent. So pass a list of axes just beyond the leading batch and channel dimensions (starting at axis 2 up to the last spatial dimension). So for 4D, it's just mean variance normalization with axes: [2,3]. The mean and variance are computed on demand.
[update] Phase 3+:
Op | float16 | float32 | notes |
---|---|---|---|
argMax | 0 | 0 | |
argMin | 0 | 0 | |
cast | 1 | 1 | |
elementwiseIf | 0 | 0 | |
equal | 0 | 0 | |
erf | ⏳ | ⏳ | |
expand | 0 | 0 | |
fillSequence | 2 | 2 | |
gather | 0 | 0 | |
greater | 0 | 0 | |
greaterOrEqual | 0 | 0 | |
identity | 0 | 0 | |
lesser | 0 | 0 | |
lesserOrEqual | 0 | 0 | |
logicalNot | 0 | 0 | |
meanVarianceNormalization | ⏳ | ⏳ | |
reciprocal | 2 | 2 | |
reshape | 0 | 0 | |
sqrt | 1 | 1 | |
triangularMatrix | 0 | 0 |
@BruceDai can you provide on update on these remaining tests, can we close this issue?
Hi @anssiko, I'm sorry for not updating this status timely.
Please see the above updated table of V1 remaining operations, now except tests for these complex gru/gruCell/lstm/lstmCell operations which are WIP by @fdwr and me , others are almost done (remaining prs were under reviewing or approved).
Regarding to V2 transformers operations, they've been already tracked by https://github.com/webmachinelearning/webnn/issues/485, now there're two remaining prs for constant (fillSequence) and triangular which are discussed on #492 and #494.
Thanks a lot for great supports from @fdwr @huningxin @Honry and @mei1127 ! 👍
@BruceDai @fdwr much thanks for your work on wpt coverage improvements.
I noted this in #240. We are expected to share an update on the wpt coverage by the upcoming CR publication transition expected next month. 100% test coverage is not expected for this transition, but the closer we get the better.
Here's process of WPT tests for remaining 20 ops with @fdwr‘s great efforts on these operations tolerances, thanks much @fdwr!
Note: Set l2Pool2d being P3 is due to issue #278.
I synced with @fdwr about tolerance definitions for gru/gruCell and lstm/lstmCell,since they're not operators but more like entire miniature graphs themselves, we need community for some help of defining them, thanks.