-
Notifications
You must be signed in to change notification settings - Fork 8
Fixed wrong result for l2Pool2d when sliding window having two valid elements #125
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
Conversation
huningxin
left a comment
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!
This issue was introduced by incorrect implementation of l2Pool2d operator for the case of sliding window having two valid elements in webnn-baseline project. I've submitted a fixing PR[1] there, then got the correct expected data for this CL. [1]: webmachinelearning/webnn-baseline#125 Bug: 383232123 Change-Id: Icdbc0859e642b832330ae309668444a000ff280d Cq-Include-Trybots: luci.chromium.try:win11-blink-rel, mac14.arm64-blink-rel, mac14-blink-rel, mac15.arm64-blink-rel, mac15-blink-rel, linux-blink-rel
src/reduce.js
Outdated
| sumOfSquares = previousValue + currentValue * currentValue; | ||
| } | ||
|
|
||
| return (currentIndex === array.length - 1) ? Math.sqrt(sumOfSquares) : sumOfSquares; |
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.
Hmm, it's kinda complicated to figure this out, given the special cases for the first and last element. Looking at what you did for other similar cases like how you implemented reduceSumSquare and reduceLogSum, would it be simpler and more compositional to implement 2D Lebesgue pooling (y = (x1^p + x2^p + ... + xn^p) ^ (1/p)) as:
export function l2Pool2d(input, options = {}) {
const squaredInput = pow(input, new Scalar(2));
const pooledInput = pool2d(squaredInput, sumReducer, options);
return pow(pooledInput, new Scalar(0.5));
}export function reduceSumSquare(input, options = {}) {
return reduceSum(pow(input, new Scalar(2)), options);
}
export function reduceLogSum(input, options = {}) {
return log(reduceSum(input, options));
}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! Please take another look, thanks!
fdwr
left a comment
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.
Yeah, much clearer (at least to me, and hopefully later generations of readers after us too 😉).
This issue was introduced by incorrect implementation of l2Pool2d operator for the case of sliding window having two valid elements in webnn-baseline project. I've submitted a fixing PR[1] there, then got the correct expected data for this CL. [1]: webmachinelearning/webnn-baseline#125 Bug: 383232123 Change-Id: Icdbc0859e642b832330ae309668444a000ff280d Cq-Include-Trybots: luci.chromium.try:win11-blink-rel, mac14.arm64-blink-rel, mac14-blink-rel, mac15.arm64-blink-rel, mac15-blink-rel, linux-blink-rel Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6415990 Reviewed-by: Austin Sullivan <asully@chromium.org> Auto-Submit: Feng Dai <feng.dai@intel.com> Reviewed-by: ningxin hu <ningxin.hu@intel.com> Commit-Queue: Feng Dai <feng.dai@intel.com> Cr-Commit-Position: refs/heads/main@{#1443301}
fdwr
left a comment
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.
Reapproving after data merge.
This issue was introduced by incorrect implementation of l2Pool2d operator for the case of sliding window having two valid elements in webnn-baseline project. I've submitted a fixing PR[1] there, then got the correct expected data for this CL. [1]: webmachinelearning/webnn-baseline#125 Bug: 383232123 Change-Id: Icdbc0859e642b832330ae309668444a000ff280d Cq-Include-Trybots: luci.chromium.try:win11-blink-rel, mac14.arm64-blink-rel, mac14-blink-rel, mac15.arm64-blink-rel, mac15-blink-rel, linux-blink-rel Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6415990 Reviewed-by: Austin Sullivan <asully@chromium.org> Auto-Submit: Feng Dai <feng.dai@intel.com> Reviewed-by: ningxin hu <ningxin.hu@intel.com> Commit-Queue: Feng Dai <feng.dai@intel.com> Cr-Commit-Position: refs/heads/main@{#1443301}
This issue was introduced by incorrect implementation of l2Pool2d operator for the case of sliding window having two valid elements in webnn-baseline project. I've submitted a fixing PR[1] there, then got the correct expected data for this CL. [1]: webmachinelearning/webnn-baseline#125 Bug: 383232123 Change-Id: Icdbc0859e642b832330ae309668444a000ff280d Cq-Include-Trybots: luci.chromium.try:win11-blink-rel, mac14.arm64-blink-rel, mac14-blink-rel, mac15.arm64-blink-rel, mac15-blink-rel, linux-blink-rel Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6415990 Reviewed-by: Austin Sullivan <asully@chromium.org> Auto-Submit: Feng Dai <feng.dai@intel.com> Reviewed-by: ningxin hu <ningxin.hu@intel.com> Commit-Queue: Feng Dai <feng.dai@intel.com> Cr-Commit-Position: refs/heads/main@{#1443301}
…tests, a=testonly Automatic update from web-platform-tests webnn: fixed wrong results for l2Pool2d tests This issue was introduced by incorrect implementation of l2Pool2d operator for the case of sliding window having two valid elements in webnn-baseline project. I've submitted a fixing PR[1] there, then got the correct expected data for this CL. [1]: webmachinelearning/webnn-baseline#125 Bug: 383232123 Change-Id: Icdbc0859e642b832330ae309668444a000ff280d Cq-Include-Trybots: luci.chromium.try:win11-blink-rel, mac14.arm64-blink-rel, mac14-blink-rel, mac15.arm64-blink-rel, mac15-blink-rel, linux-blink-rel Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6415990 Reviewed-by: Austin Sullivan <asully@chromium.org> Auto-Submit: Feng Dai <feng.dai@intel.com> Reviewed-by: ningxin hu <ningxin.hu@intel.com> Commit-Queue: Feng Dai <feng.dai@intel.com> Cr-Commit-Position: refs/heads/main@{#1443301} -- wpt-commits: ecd6a697f24a5f3206fa2b599c0a083a6b52df5a wpt-pr: 51783
…tests, a=testonly Automatic update from web-platform-tests webnn: fixed wrong results for l2Pool2d tests This issue was introduced by incorrect implementation of l2Pool2d operator for the case of sliding window having two valid elements in webnn-baseline project. I've submitted a fixing PR[1] there, then got the correct expected data for this CL. [1]: webmachinelearning/webnn-baseline#125 Bug: 383232123 Change-Id: Icdbc0859e642b832330ae309668444a000ff280d Cq-Include-Trybots: luci.chromium.try:win11-blink-rel, mac14.arm64-blink-rel, mac14-blink-rel, mac15.arm64-blink-rel, mac15-blink-rel, linux-blink-rel Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6415990 Reviewed-by: Austin Sullivan <asully@chromium.org> Auto-Submit: Feng Dai <feng.dai@intel.com> Reviewed-by: ningxin hu <ningxin.hu@intel.com> Commit-Queue: Feng Dai <feng.dai@intel.com> Cr-Commit-Position: refs/heads/main@{#1443301} -- wpt-commits: ecd6a697f24a5f3206fa2b599c0a083a6b52df5a wpt-pr: 51783
…tests, a=testonly Automatic update from web-platform-tests webnn: fixed wrong results for l2Pool2d tests This issue was introduced by incorrect implementation of l2Pool2d operator for the case of sliding window having two valid elements in webnn-baseline project. I've submitted a fixing PR[1] there, then got the correct expected data for this CL. [1]: webmachinelearning/webnn-baseline#125 Bug: 383232123 Change-Id: Icdbc0859e642b832330ae309668444a000ff280d Cq-Include-Trybots: luci.chromium.try:win11-blink-rel, mac14.arm64-blink-rel, mac14-blink-rel, mac15.arm64-blink-rel, mac15-blink-rel, linux-blink-rel Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6415990 Reviewed-by: Austin Sullivan <asully@chromium.org> Auto-Submit: Feng Dai <feng.dai@intel.com> Reviewed-by: ningxin hu <ningxin.hu@intel.com> Commit-Queue: Feng Dai <feng.dai@intel.com> Cr-Commit-Position: refs/heads/main@{#1443301} -- wpt-commits: ecd6a697f24a5f3206fa2b599c0a083a6b52df5a wpt-pr: 51783
…tests, a=testonly Automatic update from web-platform-tests webnn: fixed wrong results for l2Pool2d tests This issue was introduced by incorrect implementation of l2Pool2d operator for the case of sliding window having two valid elements in webnn-baseline project. I've submitted a fixing PR[1] there, then got the correct expected data for this CL. [1]: webmachinelearning/webnn-baseline#125 Bug: 383232123 Change-Id: Icdbc0859e642b832330ae309668444a000ff280d Cq-Include-Trybots: luci.chromium.try:win11-blink-rel, mac14.arm64-blink-rel, mac14-blink-rel, mac15.arm64-blink-rel, mac15-blink-rel, linux-blink-rel Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6415990 Reviewed-by: Austin Sullivan <asullychromium.org> Auto-Submit: Feng Dai <feng.daiintel.com> Reviewed-by: ningxin hu <ningxin.huintel.com> Commit-Queue: Feng Dai <feng.daiintel.com> Cr-Commit-Position: refs/heads/main{#1443301} -- wpt-commits: ecd6a697f24a5f3206fa2b599c0a083a6b52df5a wpt-pr: 51783 UltraBlame original commit: 85119108de0ce6ebcd38fb09b3db8ebc926841ee
…tests, a=testonly Automatic update from web-platform-tests webnn: fixed wrong results for l2Pool2d tests This issue was introduced by incorrect implementation of l2Pool2d operator for the case of sliding window having two valid elements in webnn-baseline project. I've submitted a fixing PR[1] there, then got the correct expected data for this CL. [1]: webmachinelearning/webnn-baseline#125 Bug: 383232123 Change-Id: Icdbc0859e642b832330ae309668444a000ff280d Cq-Include-Trybots: luci.chromium.try:win11-blink-rel, mac14.arm64-blink-rel, mac14-blink-rel, mac15.arm64-blink-rel, mac15-blink-rel, linux-blink-rel Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6415990 Reviewed-by: Austin Sullivan <asullychromium.org> Auto-Submit: Feng Dai <feng.daiintel.com> Reviewed-by: ningxin hu <ningxin.huintel.com> Commit-Queue: Feng Dai <feng.daiintel.com> Cr-Commit-Position: refs/heads/main{#1443301} -- wpt-commits: ecd6a697f24a5f3206fa2b599c0a083a6b52df5a wpt-pr: 51783 UltraBlame original commit: 85119108de0ce6ebcd38fb09b3db8ebc926841ee
…tests, a=testonly Automatic update from web-platform-tests webnn: fixed wrong results for l2Pool2d tests This issue was introduced by incorrect implementation of l2Pool2d operator for the case of sliding window having two valid elements in webnn-baseline project. I've submitted a fixing PR[1] there, then got the correct expected data for this CL. [1]: webmachinelearning/webnn-baseline#125 Bug: 383232123 Change-Id: Icdbc0859e642b832330ae309668444a000ff280d Cq-Include-Trybots: luci.chromium.try:win11-blink-rel, mac14.arm64-blink-rel, mac14-blink-rel, mac15.arm64-blink-rel, mac15-blink-rel, linux-blink-rel Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6415990 Reviewed-by: Austin Sullivan <asullychromium.org> Auto-Submit: Feng Dai <feng.daiintel.com> Reviewed-by: ningxin hu <ningxin.huintel.com> Commit-Queue: Feng Dai <feng.daiintel.com> Cr-Commit-Position: refs/heads/main{#1443301} -- wpt-commits: ecd6a697f24a5f3206fa2b599c0a083a6b52df5a wpt-pr: 51783 UltraBlame original commit: 85119108de0ce6ebcd38fb09b3db8ebc926841ee
…tests, a=testonly Automatic update from web-platform-tests webnn: fixed wrong results for l2Pool2d tests This issue was introduced by incorrect implementation of l2Pool2d operator for the case of sliding window having two valid elements in webnn-baseline project. I've submitted a fixing PR[1] there, then got the correct expected data for this CL. [1]: webmachinelearning/webnn-baseline#125 Bug: 383232123 Change-Id: Icdbc0859e642b832330ae309668444a000ff280d Cq-Include-Trybots: luci.chromium.try:win11-blink-rel, mac14.arm64-blink-rel, mac14-blink-rel, mac15.arm64-blink-rel, mac15-blink-rel, linux-blink-rel Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6415990 Reviewed-by: Austin Sullivan <asully@chromium.org> Auto-Submit: Feng Dai <feng.dai@intel.com> Reviewed-by: ningxin hu <ningxin.hu@intel.com> Commit-Queue: Feng Dai <feng.dai@intel.com> Cr-Commit-Position: refs/heads/main@{#1443301} -- wpt-commits: ecd6a697f24a5f3206fa2b599c0a083a6b52df5a wpt-pr: 51783
This PR is to fix the issue reported on https://issues.chromium.org/issues/383232123, the details of issue-383232123 as below.
@fdwr @huningxin PTAL, thanks!