-
Notifications
You must be signed in to change notification settings - Fork 49
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
Shall we update the spec to add constraints on the axes and the input rank for the reduction operator? #681
Comments
Suggested behavior matches the Chromium prototype implementation. Fixes webmachinelearning#681
Makes sense to me - I put up a PR |
(repeating here too) x = tensorflow.constant([3,3,3], dtype=tensorflow.float32)
y = tensorflow.reduce_sum(x, axis=[])
# value: tf.Tensor([3. 3. 3.], shape=(3,), dtype=float32)
# shape: (3,)
x = tensorflow.constant([], dtype=tensorflow.float32)
y = tensorflow.reduce_sum(x, axis=[])
# value: tf.Tensor([], shape=(0,), dtype=float32)
# shape: (0,) What's not valid is a scalar reduction with non-empty axes, because that would index axes beyond the rank, but the existing check that each axis < inputRank already validates that condition, and so checking input rank is redundant and unnecessarily exclusionary. So, we should remove that line in Chromium. |
crrev.com/c/5496321 added a restriction on the reduction ops (including argMin/argMax) that the rank of the input tensor must be greater than zero. In webmachinelearning/webnn#681, @fdwr points out that 0-D (scalar) reductions are fine, it's just a no-op. Per that discussion, this removes a restriction. There are already WPT cases for argMin/argMax (although they fail for other reasons); cases are added for the plethora of reduction ops (which also fail for other reasons). Change-Id: Ib10a9b0bb3062f9d2b6001d9a4963b14e751d14f
Groovy. I have a Chromium CL (with WPT changes) up to remove the rank check crrev.com/c/5529350 but I'm a bit rusty so it may not land for a bit. |
crrev.com/c/5496321 added a restriction on the reduction ops (including argMin/argMax) that the rank of the input tensor must be greater than zero. In webmachinelearning/webnn#681, @fdwr points out that 0-D (scalar) reductions are fine, it's just a no-op. Per that discussion, this removes a restriction. There are already WPT cases for argMin/argMax (although they fail for other reasons); cases are added for the plethora of reduction ops (which also fail for other reasons). Change-Id: Ib10a9b0bb3062f9d2b6001d9a4963b14e751d14f Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,mac14.arm64-blink-rel,win11-blink-rel
crrev.com/c/5496321 added a restriction on the reduction ops (including argMin/argMax) that the rank of the input tensor must be greater than zero. In webmachinelearning/webnn#681, @fdwr points out that 0-D (scalar) reductions are fine, it's just a no-op. Per that discussion, this removes a restriction. There are already WPT cases for argMin/argMax (although they fail for other reasons); cases are added for the plethora of reduction ops (which also fail for other reasons). Change-Id: Ib10a9b0bb3062f9d2b6001d9a4963b14e751d14f Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,mac14.arm64-blink-rel,win11-blink-rel
Oh interesting. So making the change in Chromium land actually pushes it back into |
Yeah, we have two-way sync set up with WPT. Mozilla and Apple have something similar. It's not perfect and requires some babysitting, but it's super great when it works. |
crrev.com/c/5496321 added a restriction on the reduction ops (including argMin/argMax) that the rank of the input tensor must be greater than zero. In webmachinelearning/webnn#681, @fdwr points out that 0-D (scalar) reductions are fine, it's just a no-op. Per that discussion, this removes a restriction. There are already WPT cases for argMin/argMax (although they fail for other reasons); cases are added for the plethora of reduction ops (which also fail for other reasons). Change-Id: Ib10a9b0bb3062f9d2b6001d9a4963b14e751d14f Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,mac14.arm64-blink-rel,win11-blink-rel
crrev.com/c/5496321 added a restriction on the reduction ops (including argMin/argMax) that the rank of the input tensor must be greater than zero. In webmachinelearning/webnn#681, @fdwr points out that 0-D (scalar) reductions are fine, it's just a no-op. Per that discussion, this removes a restriction. There are already WPT cases for argMin/argMax (although they fail for other reasons); cases are added for the plethora of reduction ops (which also fail for other reasons). Change-Id: Ib10a9b0bb3062f9d2b6001d9a4963b14e751d14f Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,mac14.arm64-blink-rel,win11-blink-rel
crrev.com/c/5496321 added a restriction on the reduction ops (including argMin/argMax) that the rank of the input tensor must be greater than zero. In webmachinelearning/webnn#681, @fdwr points out that 0-D (scalar) reductions are fine, it's just a no-op. Per that discussion, this removes a restriction. There are already WPT cases for argMin/argMax (although they fail for other reasons); cases are added for the plethora of reduction ops (which also fail for other reasons). Change-Id: Ib10a9b0bb3062f9d2b6001d9a4963b14e751d14f Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,mac14.arm64-blink-rel,win11-blink-rel
crrev.com/c/5496321 added a restriction on the reduction ops (including argMin/argMax) that the rank of the input tensor must be greater than zero. In webmachinelearning/webnn#681, @fdwr points out that 0-D (scalar) reductions are fine, it's just a no-op. Per that discussion, this removes a restriction. There are already WPT cases for argMin/argMax (although they fail for other reasons); cases are added for the plethora of reduction ops (which also fail for other reasons). Change-Id: Ib10a9b0bb3062f9d2b6001d9a4963b14e751d14f Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,mac14.arm64-blink-rel,win11-blink-rel
crrev.com/c/5448942 added a restriction on the reduction ops (including argMin/argMax) that the rank of the input tensor must be greater than zero. In webmachinelearning/webnn#681, @fdwr points out that 0-D (scalar) reductions are fine, it's just a no-op. Per that discussion, this removes a restriction. There are already WPT cases for argMin/argMax (although they fail for other reasons); cases are added for the plethora of reduction ops (which also fail for other reasons). Change-Id: Ib10a9b0bb3062f9d2b6001d9a4963b14e751d14f Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,mac14.arm64-blink-rel,win11-blink-rel
crrev.com/c/5448942 added a restriction on the reduction ops (including argMin/argMax) that the rank of the input tensor must be greater than zero. In webmachinelearning/webnn#681, @fdwr points out that 0-D (scalar) reductions are fine, it's just a no-op. Per that discussion, this removes a restriction. There are already WPT cases for argMin/argMax (although they fail for other reasons); cases are added for the plethora of reduction ops (which also fail for other reasons). Change-Id: Ib10a9b0bb3062f9d2b6001d9a4963b14e751d14f Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,mac14.arm64-blink-rel,win11-blink-rel
crrev.com/c/5448942 added a restriction on the reduction ops (including argMin/argMax) that the rank of the input tensor must be greater than zero. In webmachinelearning/webnn#681, @fdwr points out that 0-D (scalar) reductions are fine, it's just a no-op. Per that discussion, this removes a restriction. There are already WPT cases for argMin/argMax (although they fail for other reasons); cases are added for the plethora of reduction ops (which also fail for other reasons). Change-Id: Ib10a9b0bb3062f9d2b6001d9a4963b14e751d14f Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,mac14.arm64-blink-rel,win11-blink-rel
crrev.com/c/5448942 added a restriction on the reduction ops (including argMin/argMax) that the rank of the input tensor must be greater than zero. In webmachinelearning/webnn#681, @fdwr points out that 0-D (scalar) reductions are fine, it's just a no-op. Per that discussion, this removes a restriction. There are already WPT cases for argMin/argMax (although they fail for other reasons); cases are added for the plethora of reduction ops (which also fail for other reasons). Change-Id: Ib10a9b0bb3062f9d2b6001d9a4963b14e751d14f Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,mac14.arm64-blink-rel,win11-blink-rel
crrev.com/c/5448942 added a restriction on the reduction ops (including argMin/argMax) that the rank of the input tensor must be greater than zero. In webmachinelearning/webnn#681, @fdwr points out that 0-D (scalar) reductions are fine, it's just a no-op. Per that discussion, this removes a restriction. There are already WPT cases for argMin/argMax (although they fail for other reasons); cases are added for the plethora of reduction ops (which also fail for other reasons). Change-Id: Ib10a9b0bb3062f9d2b6001d9a4963b14e751d14f Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,mac14.arm64-blink-rel,win11-blink-rel Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5529350 Reviewed-by: Phillis Tang <[email protected]> Reviewed-by: ningxin hu <[email protected]> Commit-Queue: Joshua Bell <[email protected]> Cr-Commit-Position: refs/heads/main@{#1301369}
crrev.com/c/5448942 added a restriction on the reduction ops (including argMin/argMax) that the rank of the input tensor must be greater than zero. In webmachinelearning/webnn#681, @fdwr points out that 0-D (scalar) reductions are fine, it's just a no-op. Per that discussion, this removes a restriction. There are already WPT cases for argMin/argMax (although they fail for other reasons); cases are added for the plethora of reduction ops (which also fail for other reasons). Change-Id: Ib10a9b0bb3062f9d2b6001d9a4963b14e751d14f Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,mac14.arm64-blink-rel,win11-blink-rel Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5529350 Reviewed-by: Phillis Tang <[email protected]> Reviewed-by: ningxin hu <[email protected]> Commit-Queue: Joshua Bell <[email protected]> Cr-Commit-Position: refs/heads/main@{#1301369}
crrev.com/c/5448942 added a restriction on the reduction ops (including argMin/argMax) that the rank of the input tensor must be greater than zero. In webmachinelearning/webnn#681, @fdwr points out that 0-D (scalar) reductions are fine, it's just a no-op. Per that discussion, this removes a restriction. There are already WPT cases for argMin/argMax (although they fail for other reasons); cases are added for the plethora of reduction ops (which also fail for other reasons). Change-Id: Ib10a9b0bb3062f9d2b6001d9a4963b14e751d14f Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,mac14.arm64-blink-rel,win11-blink-rel Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5529350 Reviewed-by: Phillis Tang <[email protected]> Reviewed-by: ningxin hu <[email protected]> Commit-Queue: Joshua Bell <[email protected]> Cr-Commit-Position: refs/heads/main@{#1301369}
…testonly Automatic update from web-platform-tests WebNN: Allow 0-D (scalar) reductions crrev.com/c/5448942 added a restriction on the reduction ops (including argMin/argMax) that the rank of the input tensor must be greater than zero. In webmachinelearning/webnn#681, @fdwr points out that 0-D (scalar) reductions are fine, it's just a no-op. Per that discussion, this removes a restriction. There are already WPT cases for argMin/argMax (although they fail for other reasons); cases are added for the plethora of reduction ops (which also fail for other reasons). Change-Id: Ib10a9b0bb3062f9d2b6001d9a4963b14e751d14f Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,mac14.arm64-blink-rel,win11-blink-rel Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5529350 Reviewed-by: Phillis Tang <[email protected]> Reviewed-by: ningxin hu <[email protected]> Commit-Queue: Joshua Bell <[email protected]> Cr-Commit-Position: refs/heads/main@{#1301369} -- wpt-commits: 22a06eb294cd23846add1c8ca8e234bc9d7260c6 wpt-pr: 46209
…testonly Automatic update from web-platform-tests WebNN: Allow 0-D (scalar) reductions crrev.com/c/5448942 added a restriction on the reduction ops (including argMin/argMax) that the rank of the input tensor must be greater than zero. In webmachinelearning/webnn#681, @fdwr points out that 0-D (scalar) reductions are fine, it's just a no-op. Per that discussion, this removes a restriction. There are already WPT cases for argMin/argMax (although they fail for other reasons); cases are added for the plethora of reduction ops (which also fail for other reasons). Change-Id: Ib10a9b0bb3062f9d2b6001d9a4963b14e751d14f Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,mac14.arm64-blink-rel,win11-blink-rel Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5529350 Reviewed-by: Phillis Tang <[email protected]> Reviewed-by: ningxin hu <[email protected]> Commit-Queue: Joshua Bell <[email protected]> Cr-Commit-Position: refs/heads/main@{#1301369} -- wpt-commits: 22a06eb294cd23846add1c8ca8e234bc9d7260c6 wpt-pr: 46209
(This was raised by @a-sully in Chromium CL-5496412 review.)
For WebNN's reduction operator:
Austion proposed to update the spec to add constraints on the axes and the input rank.
/cc @a-sully
The text was updated successfully, but these errors were encountered: