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 <dfn method for=MLGraphBuilder>gatherNd(|input|, |indices|, |options|)</dfn> method steps are:
4517
4517
</summary>
4518
-
TODO:
4518
+
1. If [=this=][=MLGraphBuilder/can not build=], then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}.
4519
+
1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input| and |indices| returns false, then [=exception/throw=] a {{TypeError}}.
4520
+
1. If |input|'s or |indices|'s [=MLOperand/dataType=]'s are not one of their [=/allowed data types=] (according to [this table](#constraints-gather)), then [=exception/throw=] a {{TypeError}}.
4521
+
1. Let |shapeInput| be |input|'s [=MLOperand/shape=] and |rankInput| be |input|'s [=MLOperand/rank=].
4522
+
1. Let |shapeIndices| be |indices|'s [=MLOperand/shape=] and |rankIndices| be |indices|'s [=MLOperand/rank=].
4523
+
1. If |rankInput| or |rankIndices| is less than 1, then [=exception/throw=] a {{TypeError}}.
4524
+
1. Let |indexableSize| be |rankIndices| - 1.
4525
+
1. Let |coordinateSize| be |shapeIndices|[|indexableSize|].
4526
+
1. If |coordinateSize| is greater than |inputRank|, then [=exception/throw=] a {{TypeError}}.
4527
+
1. Let |shapeOutput| be an empty list.
4528
+
1. [=list/For each=] |index| in [=the range=] 0 to |indexableSize|, exclusive:
4529
+
1. [=list/Append=] |shapeIndices|[|index|] to |shapeOutput|.
4530
+
1. [=list/For each=] |index| in [=the range=] |coordinateSize| to |rankInput|, exclusive:
4531
+
1. [=list/Append=] |shapeInput|[|index|] to |shapeOutput|.
4532
+
1. Let |outputDesc| be the result of [=creating an MLOperandDescriptor=] given |input|'s [=MLOperand/dataType=] and |shapeOutput|.
4533
+
1. *Make graph connections:*
4534
+
1. Let |output| be the result of [=creating an MLOperand=] given |outputDesc|.
4535
+
1. Let |operator| be an [=operator=] for the "gatherNd" operation, given |input|, |indices|, and |options|.
4536
+
1. Set |output|.{{MLOperand/[[operator]]}} to |operator|.
4537
+
1. Set |operator|'s [=operator/inputs=] to |input| and |indices|.
4538
+
1. Set |operator|'s [=operator/output=] to |output|.
The <dfn method for=MLGraphBuilder>scatterNd(|input|, |indices|, |updates|, |options|)</dfn> method steps are:
8515
8536
</summary>
8516
-
TODO:
8537
+
1. If [=this=][=MLGraphBuilder/can not build=], then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}.
8538
+
1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |indices|, and |updates| returns false, then [=exception/throw=] a {{TypeError}}.
8539
+
1. If |input|'s or |indices|'s [=MLOperand/dataType=]'s are not one of their [=/allowed data types=] (according to [this table](#constraints-gather)), then [=exception/throw=] a {{TypeError}}.
8540
+
1. If |udpates|'s [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}.
8541
+
1. Let |shapeInput| be |input|'s [=MLOperand/shape=] and |rankInput| be |input|'s [=MLOperand/rank=].
8542
+
1. Let |shapeIndices| be |indices|'s [=MLOperand/shape=] and |rankIndices| be |indices|'s [=MLOperand/rank=].
8543
+
1. If |rankInput| or |rankIndices| is less than 1, then [=exception/throw=] a {{TypeError}}.
8544
+
1. Let |indexableSize| be |rankIndices| - 1.
8545
+
1. Let |coordinateSize| be |shapeIndices|[|indexableSize|].
8546
+
1. If |coordinateSize| is greater than |inputRank|, then [=exception/throw=] a {{TypeError}}.
8547
+
1. Let |shapeUpdates| be an empty list.
8548
+
1. [=list/For each=] |index| in [=the range=] 0 to |indexableSize|, exclusive:
8549
+
1. [=list/Append=] |shapeIndices|[|index|] to |shapeUpdates|.
8550
+
1. [=list/For each=] |index| in [=the range=] |coordinateSize| to |rankInput|, exclusive:
8551
+
1. [=list/Append=] |shapeInput|[|index|] to |shapeUpdates|.
8552
+
1. Let |updates|'s [=MLOperand/shape=] is not equal to |shapeUpdates|, then [=exception/throw=] a {{TypeError}}.
8553
+
1. Let |outputShape| be a copy of |input|'s [=MLOperand/shape=].
8554
+
1. Let |outputDesc| be the result of [=creating an MLOperandDescriptor=] given |input|'s [=MLOperand/dataType=] and |shapeOutput|.
8555
+
1. *Make graph connections:*
8556
+
1. Let |output| be the result of [=creating an MLOperand=] given |outputDesc|.
8557
+
1. Let |operator| be an [=operator=] for the "scatterNd" operation, given |input|, |indices|, |updates|, and |options|.
8558
+
1. Set |output|.{{MLOperand/[[operator]]}} to |operator|.
8559
+
1. Set |operator|'s [=operator/inputs=] to |input|, |indices|, and |updates|.
8560
+
1. Set |operator|'s [=operator/output=] to |output|.
0 commit comments