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
The permissions and context validity have been checked by [[#api-mlgraphbuilder-constructor]] steps.
2863
2863
</div>
2864
-
1. If any of the following steps fail, then [=exception/throw=] a "{{DataError}}" {{DOMException}}.
2865
-
1. Let |inputDesc| be |input|.{{MLOperand/[[descriptor]]}}.
2866
-
1. If the sequence length of |newShape| is not equal to the [=rank=] of |inputDesc|, then [=exception/throw=] a "{{DataError}}" {{DOMException}}.
2867
-
1. Let |outputDesc| be a copy of |inputDesc|.
2868
-
1. [=list/For each=] |index| in [=the range=] 0 to the [=rank=] of |input|, exclusive:
2869
-
Issue: Can this be replaced with [=unidirectionally broadcasting the shapes=] |inputDesc| and |newShape|.
2870
-
1. Let |size| be the |input|.{{MLOperand/shape()}}[|index|].
2871
-
1. If |size| is not equal to 1 and not equal to |newShape|[index], then [=exception/throw=] a "{{DataError}}" {{DOMException}}.
2872
-
1. If |size| is equal to 1, then let |outputDesc|.{{MLOperandDescriptor/dimensions}}[|index|] be |newShape|[|index|].
2864
+
1. Let |descriptor| be a new {{MLOperandDescriptor}}.
2865
+
1. Set |descriptor|.{{MLOperandDescriptor/dataType}} to |input|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dataType}}.
2866
+
1. Set |descriptor|.{{MLOperandDescriptor/dimensions}} to the result of [=unidirectionally broadcasting the shapes=] |input|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}} and |newShape|.
2867
+
1. If that returns failure, then [=exception/throw=] a "{{DataError}}" {{DOMException}}.
2873
2868
1. If any of the following sub-steps fail, [=exception/throw=] an "{{OperationError}}" {{DOMException}}.
2874
-
1. Let |output| be the result of [=creating an MLOperand=] given [=this=] and |outputDesc|.
2869
+
1. Let |output| be the result of [=creating an MLOperand=] given [=this=] and |descriptor|.
2875
2870
1. Make a request to the underlying platform to:
2876
2871
1. Create [=platform operator=] |expandImpl| for this method, given |input| and |newShape|.
2877
2872
1. Set |output|.{{MLOperand/[[operator]]}} to |expandImpl|.
0 commit comments