-
Notifications
You must be signed in to change notification settings - Fork 51
Remove pool2d MLRoundingType - Simplify the operand layout support of conv2d and pooling 2d operations #770
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
base: main
Are you sure you want to change the base?
Conversation
index.bs
Outdated
@@ -5451,7 +5427,7 @@ partial dictionary MLOpSupportLimits { | |||
1. If |options|.{{MLPool2dOptions/dilations}}'s [=list/size=] is not 2, then [=exception/throw=] a {{TypeError}}. | |||
1. If any value in |options|.{{MLPool2dOptions/dilations}} is not greater than 0, then [=exception/throw=] a {{TypeError}}. | |||
1. Let |desc| be a copy of |input|.{{MLOperand/[[descriptor]]}}. | |||
1. Let |outputShape| be the result of [=MLGraphBuilder/calculating pool2d output sizes=] given |options|.{{MLPool2dOptions/layout}}, |input|'s [=MLOperand/shape=], |options|.{{MLPool2dOptions/roundingType}}, |options|.{{MLPool2dOptions/windowDimensions}}, |options|.{{MLPool2dOptions/padding}}, |options|.{{MLPool2dOptions/strides}}, |options|.{{MLPool2dOptions/dilations}}, and |options|.{{MLPool2dOptions/outputSizes}} (if it [=map/exists=]). | |||
1. Let |outputShape| be the result of [=MLGraphBuilder/calculating pool2d output sizes=] given |options|.{{MLPool2dOptions/layout}}, |input|'s [=MLOperand/shape=], |options|.{{MLPool2dOptions/windowDimensions}}, |options|.{{MLPool2dOptions/padding}}, |options|.{{MLPool2dOptions/strides}}, |options|.{{MLPool2dOptions/dilations}}, and |options|.{{MLPool2dOptions/outputSizes}} (if it [=map/exists=]). |
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.
The outputSizes validation above in 13.2 doesn't appear to be correct--shouldn't it be similar to this logic?
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.
I think this is now resolved by Joshua?
This implicitly resolves #374 as well, doesn't it? |
This PR needs a redo since there's been a lot of spec churn since Nov 2024. But one thing I noticed in the current spec text:
That implies that if outputSizes becomes a required option, then any passed padding will always be ignored. Flaw in the current text? I think the first clause "if options.outputSizes exists" is bogus today, and should be removed. |
I'm confused by the build errors, as I didn't touch any of those lines, and
|
the build error is indeed unrelated to the particular change, but linked to the definition set bikeshed uses for auto-linking. the simplest short term solution is to add |
…verlong IDL error
…ing goes right rather than just silence
@dontcallmedom Thanks, that helped. I encountered a few other random errors (some which were unrelated to my change 🙃), and so I had to extend the linter to display line numbers to save my sanity:
|
Fixes #324
Rather than having two output shape parameters, an explicit output size and an output rounding mode, be more explicit in WebNN such that the caller passes the explicit output shape, resolving any higher-level policy beforehand (like with
convTranspose2d
):dictionary MLPool2dOptions : MLOperatorOptions { sequence<[EnforceRange] unsigned long> windowDimensions; sequence<[EnforceRange] unsigned long> padding; sequence<[EnforceRange] unsigned long> strides; sequence<[EnforceRange] unsigned long> dilations; MLInputOperandLayout layout = "nchw"; - MLRoundingType roundingType = "floor"; sequence<[EnforceRange] unsigned long> outputSizes; };
Additional changes:
spec:infra; type:dfn; text:string
due to new build failures unrelated to my change (thanks Dominique).Preview | Diff