You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Restrict padding options to better match backend limits (#843)
* Restrict padding options to better match backend limits
Per discussion in the linked issues and working group, drop
"symmetric" padding since it is not widely supported by backends,
isn't used by notable models, and can be emulated. Also for
non-constant padding, backends typically impose restrictions on the
amount of padding to reasonable values based on the input size, so
incorporate those limits too.
Resolves#377. Resolves#739.
* Update index.bs
Co-authored-by: Dwayne Robinson <[email protected]>
* Remove 'edge' restrictions
---------
Co-authored-by: Dwayne Robinson <[email protected]>
1. If |beginningPadding|'s [=list/size=] and |endingPadding|'s [=list/size=] are not both equal to |input|'s [=MLOperand/rank=], then [=exception/throw=] a {{TypeError}}.
7335
7334
1. Let |desc| be a copy of |input|.{{MLOperand/[[descriptor]]}}.
7336
7335
1. Let |outputShape| be a copy of |input|'s [=MLOperand/shape=].
7337
-
1. [=list/For each=] |index| in [=the range=] 0 to |outputShape|'s [=MLOperand/rank=], exclusive:
7336
+
1. [=list/For each=] |index| in [=the exclusive range|the range=] 0 to |outputShape|'s [=MLOperand/rank=], exclusive:
7337
+
1. Switch on |options|.{{MLPadOptions/mode}}:
7338
+
<dl class=switch>
7339
+
: {{MLPaddingMode/"constant"}}
7340
+
:: Do nothing.
7341
+
7342
+
: {{MLPaddingMode/"edge"}}
7343
+
:: Do nothing.
7344
+
7345
+
: {{MLPaddingMode/"reflection"}}
7346
+
::
7347
+
1. If |beginningPadding|[|index|] is greater than or equal to |outputShape|[|index|], then [=exception/throw=] a {{TypeError}}.
7348
+
1. If |endingPadding|[|index|] is greater than or equal to |outputShape|[|index|], then [=exception/throw=] a {{TypeError}}.
7349
+
</dl>
7338
7350
1. Add to |outputShape|[|index|] the value of |beginningPadding|[|index|].
7339
7351
1. Add to |outputShape|[|index|] the value of |endingPadding|[|index|].
7340
7352
1. If any [=list/item=] in |outputShape| is not a [=valid dimension=], then [=exception/throw=] a {{TypeError}}.
0 commit comments