-
Notifications
You must be signed in to change notification settings - Fork 48
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
Throw TypeError for all input validation #589
Conversation
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.
@a-sully , thanks for making this PR!
A few instances use RangeError Fixes webmachinelearning#583
We discussed this topic internally, kicked off by @inexorabletash's observation that Taking a step back, we should express as many of these constraints in the IDL (as opposed to the algorithm text) as possible. That's what #562 is all about. But many of these constraints are not (yet) expressible via WebIDL. That leads to the question of what might a future WebIDL do if it added support for e.g. range validation, default non-empty sequences, etc? Ideally we could anticipate this and throw the appropriate errors for WebNN... ...Given that even the Thoughts? |
Apologies for the force-push (there were several conflicts) but the diff is just s/RangeError/TypeError |
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, thanks @a-sully !
@a-sully , you may want to update your first comment where
it may not be true in the latest commit. |
Good catch @huningxin. I've updated the PR description and title. Please feel free to merge at your convenience Thanks all for the reviews! |
Just kidding, I just noticed that @fdwr hasn't looked at this yet. Dwayne, PTAL and merge at your convenience, if it looks good :) |
For cases like these...
...wouldn't they best be described as One good DataError case is:
|
(read Joshua's comment above) 🤔 Well I still think
👍 |
SHA: ca0b903 Reason: push, by fdwr Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
The spec had been updated to throw TypeError for failed input validations: webmachinelearning/webnn#589. This CL replaces the last remaining DataErrors in lstm implementation and triangular wpt. Bug: 40206287 Change-Id: I73952ce5b407f2df1d9d3b22c0086638d092e811 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5632940 Commit-Queue: Austin Sullivan <[email protected]> Reviewed-by: Austin Sullivan <[email protected]> Auto-Submit: Jiewei Qian <[email protected]> Cr-Commit-Position: refs/heads/main@{#1317381}
The spec had been updated to throw TypeError for failed input validations: webmachinelearning/webnn#589. This CL replaces the last remaining DataErrors in lstm implementation and triangular wpt. Bug: 40206287 Change-Id: I73952ce5b407f2df1d9d3b22c0086638d092e811 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5632940 Commit-Queue: Austin Sullivan <[email protected]> Reviewed-by: Austin Sullivan <[email protected]> Auto-Submit: Jiewei Qian <[email protected]> Cr-Commit-Position: refs/heads/main@{#1317381}
The spec had been updated to throw TypeError for failed input validations: webmachinelearning/webnn#589. This CL replaces the last remaining DataErrors in lstm implementation and triangular wpt. Bug: 40206287 Change-Id: I73952ce5b407f2df1d9d3b22c0086638d092e811 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5632940 Commit-Queue: Austin Sullivan <[email protected]> Reviewed-by: Austin Sullivan <[email protected]> Auto-Submit: Jiewei Qian <[email protected]> Cr-Commit-Position: refs/heads/main@{#1317381}
… a=testonly Automatic update from web-platform-tests webnn: replace DataError with TypeError The spec had been updated to throw TypeError for failed input validations: webmachinelearning/webnn#589. This CL replaces the last remaining DataErrors in lstm implementation and triangular wpt. Bug: 40206287 Change-Id: I73952ce5b407f2df1d9d3b22c0086638d092e811 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5632940 Commit-Queue: Austin Sullivan <[email protected]> Reviewed-by: Austin Sullivan <[email protected]> Auto-Submit: Jiewei Qian <[email protected]> Cr-Commit-Position: refs/heads/main@{#1317381} -- wpt-commits: b03730d3049c601dbd807c50643f3f38ff9a0add wpt-pr: 46845
… a=testonly Automatic update from web-platform-tests webnn: replace DataError with TypeError The spec had been updated to throw TypeError for failed input validations: webmachinelearning/webnn#589. This CL replaces the last remaining DataErrors in lstm implementation and triangular wpt. Bug: 40206287 Change-Id: I73952ce5b407f2df1d9d3b22c0086638d092e811 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5632940 Commit-Queue: Austin Sullivan <[email protected]> Reviewed-by: Austin Sullivan <[email protected]> Auto-Submit: Jiewei Qian <[email protected]> Cr-Commit-Position: refs/heads/main@{#1317381} -- wpt-commits: b03730d3049c601dbd807c50643f3f38ff9a0add wpt-pr: 46845
… a=testonly Automatic update from web-platform-tests webnn: replace DataError with TypeError The spec had been updated to throw TypeError for failed input validations: webmachinelearning/webnn#589. This CL replaces the last remaining DataErrors in lstm implementation and triangular wpt. Bug: 40206287 Change-Id: I73952ce5b407f2df1d9d3b22c0086638d092e811 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5632940 Commit-Queue: Austin Sullivan <[email protected]> Reviewed-by: Austin Sullivan <[email protected]> Auto-Submit: Jiewei Qian <[email protected]> Cr-Commit-Position: refs/heads/main@{#1317381} -- wpt-commits: b03730d3049c601dbd807c50643f3f38ff9a0add wpt-pr: 46845
… a=testonly Automatic update from web-platform-tests webnn: replace DataError with TypeError The spec had been updated to throw TypeError for failed input validations: webmachinelearning/webnn#589. This CL replaces the last remaining DataErrors in lstm implementation and triangular wpt. Bug: 40206287 Change-Id: I73952ce5b407f2df1d9d3b22c0086638d092e811 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5632940 Commit-Queue: Austin Sullivan <asullychromium.org> Reviewed-by: Austin Sullivan <asullychromium.org> Auto-Submit: Jiewei Qian <qjwchromium.org> Cr-Commit-Position: refs/heads/main{#1317381} -- wpt-commits: b03730d3049c601dbd807c50643f3f38ff9a0add wpt-pr: 46845 UltraBlame original commit: 5e7160c2c0eae28706bcdec3b49e789ec48e360e
… a=testonly Automatic update from web-platform-tests webnn: replace DataError with TypeError The spec had been updated to throw TypeError for failed input validations: webmachinelearning/webnn#589. This CL replaces the last remaining DataErrors in lstm implementation and triangular wpt. Bug: 40206287 Change-Id: I73952ce5b407f2df1d9d3b22c0086638d092e811 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5632940 Commit-Queue: Austin Sullivan <asullychromium.org> Reviewed-by: Austin Sullivan <asullychromium.org> Auto-Submit: Jiewei Qian <qjwchromium.org> Cr-Commit-Position: refs/heads/main{#1317381} -- wpt-commits: b03730d3049c601dbd807c50643f3f38ff9a0add wpt-pr: 46845 UltraBlame original commit: 5e7160c2c0eae28706bcdec3b49e789ec48e360e
The spec had been updated to throw TypeError for failed input validations: webmachinelearning/webnn#589. This CL replaces the last remaining DataErrors in lstm implementation and triangular wpt. Bug: 40206287 Change-Id: I73952ce5b407f2df1d9d3b22c0086638d092e811 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5632940 Commit-Queue: Austin Sullivan <[email protected]> Reviewed-by: Austin Sullivan <[email protected]> Auto-Submit: Jiewei Qian <[email protected]> Cr-Commit-Position: refs/heads/main@{#1317381}
This PR removes all uses of
DataError
from the spec in favor of usingTypeError
for all input validationNotably, all validation checks and output shape calculations related to operand axes/ranks/dimensions/shapes are treated as
TypeError
with the rationale that axes/ranks/dimensions/shapes do not constitute an operand's data, but its type (as C++ does, for example)Fixes #583
Preview | Diff