Skip to content

Comments

Bugfix: Add missing validation for conv2d() and convTranspose2d()#706

Merged
huningxin merged 1 commit intowebmachinelearning:mainfrom
huningxin:conv2d_missing_validation
Jun 13, 2024
Merged

Bugfix: Add missing validation for conv2d() and convTranspose2d()#706
huningxin merged 1 commit intowebmachinelearning:mainfrom
huningxin:conv2d_missing_validation

Conversation

@huningxin
Copy link
Contributor

@huningxin huningxin commented Jun 12, 2024

According to audit result of Chromium prototype, there are a few missing validations in the spec. This PR adds missing validations for conv2d() and convTranspose2d(). Other missing validations will be addressed by follow-up PRs.

@inexorabletash @fdwr , PTAL.


Preview | Diff

@huningxin huningxin requested review from fdwr and inexorabletash June 12, 2024 03:22
Copy link
Collaborator

@fdwr fdwr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks for bringing spec and implementation to more congruence.

Copy link
Contributor

@inexorabletash inexorabletash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

</dl>
1. If |inputChannels| is not equal to |filterInputChannels|, then [=exception/throw=] a {{TypeError}}.
1. Let |outputChannels| be |filterOutputChannels| * |options|.{{MLConvTranspose2dOptions/groups}}
1. Let |outputChannels| be |filterOutputChannels| * |options|.{{MLConvTranspose2dOptions/groups}}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside: We could add a lint check that algorithm steps end with : or .

@huningxin huningxin merged commit 96198a4 into webmachinelearning:main Jun 13, 2024
github-actions bot added a commit that referenced this pull request Jun 13, 2024
SHA: 96198a4
Reason: push, by huningxin

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fdwr pushed a commit that referenced this pull request Feb 22, 2025
* Add missing validation steps for several ops

A follow-on to #706 and the
[audit](https://docs.google.com/spreadsheets/d/1S5-bMWN1hDrkPGiHFCyX-OjcbEBj1a-aWNdtTQ2dcGg)
by @huningxin that adds validation steps to several ops identified for
edge cases in the Chromium prototype implementation.

This touches the following ops:

- convTranspose2d - outputSizes items must be valid dimensions
- lstm - steps must be greater than 0
- pool2d - windowDimensions must be greater than 0
- pool2d - outputSizes items must be valid dimensions
- pool2d - specified output sizes must be floor() or ceil() of calculated output sizes
- split - splits (if a number) must be greater than 0

Fixes #818 as well.

* Review feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants