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
Bug fix: resample2d output size calculation algorithm and usage
* Per #395 make it clearer that the algorithm is working on a new
descriptor (a copy of the input's)
* When invoking the algorithm, pass the required input argument.
* Rename algorithm from "resample output sizes" to "calculate resample
output sizes" which more clearly descripts what is happening and
aligns with similar algorithms in the spec.
To <dfn for="MLGraphBuilder">resample output sizes</dfn> given |input| and |options|, run the following steps:
5281
+
To <dfn for="MLGraphBuilder">calculate resample output sizes</dfn> given |input| and |options|, run the following steps:
5282
5282
</summary>
5283
5283
<div class=algorithm-steps>
5284
-
1. Let |desc| be an{{MLOperandDescriptor}} initialized to |input|.{{MLOperand/[[descriptor]]}}.
5284
+
1. Let |desc| be a new{{MLOperandDescriptor}} initialized to |input|.{{MLOperand/[[descriptor]]}}.
5285
5285
1. For |index| in [=the range=] 0 to the [=list/size=] of |options|.{{MLResample2dOptions/axes}}, exclusive:
5286
5286
1. If |options|.{{MLResample2dOptions/sizes}}[=map/exists=], set |desc|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}}[|options|.{{MLResample2dOptions/axes}}[|index|]] to |options|.{{MLResample2dOptions/sizes}}[|index|] and return |desc|.
5287
5287
1. Otherwise, set |desc|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}}[|options|.{{MLResample2dOptions/axes}}[|index|]] to |input|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}}[|index|] multiplied by |options|.{{MLResample2dOptions/scales}}.
1. If the [=list/size=] of |input|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}} is not 4, then [=exception/throw=] a "{{DataError}}" {{DOMException}}.
5299
5299
1. If [=checking resample options=] given |options| returns false, then [=exception/throw=] a "{{DataError}}" {{DOMException}}.
5300
-
1. Let |desc| be the result of [=resampling output sizes=] given |options|.
5301
-
1. If that [=exception/throws=] an error, re-[=exception/throw=] the error.
5300
+
1. Let |desc| be the result of [=calculating resample output sizes=] given |input| and |options|.
5302
5301
1. If any of the following sub-steps fail, [=exception/throw=] an "{{OperationError}}" {{DOMException}}.
5303
5302
1. Let |output| be the result of [=creating an MLOperand=] given [=this=] and |desc|.
0 commit comments