Skip to content

Commit 356febd

Browse files
committed
Additional change of output tensor rank
1. Add allowed ranks for all lstm and gru output tensors. 2. Validate new shape's rank of expand and reshape operations. 3. Simplify allowed ranks for some operations based on implementation experience. 4. Other minor changes for consistency.
1 parent 69b43cd commit 356febd

1 file changed

Lines changed: 42 additions & 28 deletions

File tree

‎index.bs‎

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2241,8 +2241,8 @@ partial dictionary MLOpSupportLimits {
22412241
</tr>
22422242
<tr>
22432243
<td>*output*</td>
2244-
<td>{{MLArgMinMaxOptions/outputDataType}}</td>
2245-
<td>{{input}}'s [=MLOperand/rank=] - 1 to {{input}}'s [=MLOperand/rank=]</td>
2244+
<td>{{MLOperandDataType/"int32"}}, {{MLOperandDataType/"int64"}}</td>
2245+
<td>[=/any rank|N=]</td>
22462246
</tr>
22472247
</table>
22482248

@@ -2506,7 +2506,7 @@ partial dictionary MLOpSupportLimits {
25062506
</tr>
25072507
<tr>
25082508
<td>*output*</td>
2509-
<td>{{dataType}}</td>
2509+
<td>[=/any data type|any=]</td>
25102510
<td>[=/same rank as|same as=] {{input}}</td>
25112511
</tr>
25122512
</table>
@@ -3425,7 +3425,7 @@ partial dictionary MLOpSupportLimits {
34253425
<tr>
34263426
<td>*output*</td>
34273427
<td>[=/same type as|same as=] {{a}}</td>
3428-
<td>maximum of {{a}}'s [=MLOperand/rank=] and {{b}}'s [=MLOperand/rank=]</td>
3428+
<td>[=/any rank|N=]</td>
34293429
</tr>
34303430
</table>
34313431

@@ -3612,7 +3612,7 @@ partial dictionary MLOpSupportLimits {
36123612
<tr>
36133613
<td>*output*</td>
36143614
<td>{{MLOperandDataType/"uint8"}}</td>
3615-
<td>maximum of {{a}}'s [=MLOperand/rank=] and {{b}}'s [=MLOperand/rank=]</td>
3615+
<td>[=/any rank|N=]</td>
36163616
</tr>
36173617
</table>
36183618

@@ -4490,7 +4490,7 @@ partial dictionary MLOpSupportLimits {
44904490
<tr>
44914491
<td>*output*</td>
44924492
<td>[=/same type as|same as=] {{input}}</td>
4493-
<td>{{newShape}}'s [=list/size=]</td>
4493+
<td>[=/any rank|N=]</td>
44944494
</tr>
44954495
</table>
44964496

@@ -4508,6 +4508,7 @@ partial dictionary MLOpSupportLimits {
45084508
1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}.
45094509
1. Let |outputShape| be the result of [=unidirectionally broadcasting=] |input|'s [=MLOperand/shape=] and |newShape|.
45104510
1. If that returns failure, then [=exception/throw=] a {{TypeError}}.
4511+
1. If |outputShape|'s [=list/size=] is not output tensor's [=/allowed ranks=] (according to [this table](#constraints-expand)), then [=exception/throw=] a {{TypeError}}.
45114512
1. Let |outputDescriptor| be the result of [=creating an MLOperandDescriptor=] given |input|'s [=MLOperand/dataType=] and |outputShape|.
45124513
1. *Make graph connections:*
45134514
1. Let |output| be the result of [=creating an MLOperand=] given [=this=] and |outputDescriptor|.
@@ -4584,7 +4585,7 @@ partial dictionary MLOpSupportLimits {
45844585
<tr>
45854586
<td>*output*</td>
45864587
<td>[=/same type as|same as=] {{input}}</td>
4587-
<td>{{input}}'s [=MLOperand/rank=] + {{indices}}'s [=MLOperand/rank=] - 1</td>
4588+
<td>[=/any rank|N=]</td>
45884589
</tr>
45894590
</table>
45904591

@@ -4911,7 +4912,7 @@ partial dictionary MLOpSupportLimits {
49114912
<tr>
49124913
<td>*output*</td>
49134914
<td>[=/same type as|same as=] {{input}}</td>
4914-
<td>{{input}}'s [=MLOperand/rank=] + {{indices}}'s [=MLOperand/rank=] - {{indices}}'s [=MLOperand/shape=][-1] - 1</td>
4915+
<td>[=/any rank|N=]</td>
49154916
</tr>
49164917
</table>
49174918

@@ -5353,7 +5354,8 @@ dictionary MLGruSupportLimits {
53535354
MLTensorLimits bias;
53545355
MLTensorLimits recurrentBias;
53555356
MLTensorLimits initialHiddenState;
5356-
MLTensorLimits outputs;
5357+
MLTensorLimits output0;
5358+
MLTensorLimits output1;
53575359
};
53585360

53595361
partial dictionary MLOpSupportLimits {
@@ -5474,8 +5476,10 @@ partial dictionary MLOpSupportLimits {
54745476
:: {{MLTensorLimits}} for recurrentBias operand.
54755477
: <dfn>initialHiddenState</dfn>
54765478
:: {{MLTensorLimits}} for initialHiddenState operand.
5477-
: <dfn>outputs</dfn>
5478-
:: {{MLTensorLimits}} for all the output operands.
5479+
: <dfn>output0</dfn>
5480+
:: {{MLTensorLimits}} for all the output operands[0].
5481+
: <dfn>output1</dfn>
5482+
:: {{MLTensorLimits}} for all the output operands[1].
54795483
</dl>
54805484

54815485
{{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/gru()}}:
@@ -6359,12 +6363,12 @@ partial dictionary MLOpSupportLimits {
63596363
<tr>
63606364
<td>{{MLLayerNormalizationOptions/scale}}</td>
63616365
<td>[=/same type as|same as=] {{input}}</td>
6362-
<td>0 to {{input}}'s [=MLOperand/rank=]</td>
6366+
<td>[=/any rank|N=]</td>
63636367
</tr>
63646368
<tr>
63656369
<td>{{MLLayerNormalizationOptions/bias}}</td>
63666370
<td>[=/same type as|same as=] {{input}}</td>
6367-
<td>0 to {{input}}'s [=MLOperand/rank=]</td>
6371+
<td>[=/any rank|N=]</td>
63686372
</tr>
63696373
<tr>
63706374
<td>*output*</td>
@@ -6674,7 +6678,9 @@ dictionary MLLstmSupportLimits {
66746678
MLTensorLimits peepholeWeight;
66756679
MLTensorLimits initialHiddenState;
66766680
MLTensorLimits initialCellState;
6677-
MLTensorLimits outputs;
6681+
MLTensorLimits output0;
6682+
MLTensorLimits output1;
6683+
MLTensorLimits output2;
66786684
};
66796685

66806686
partial dictionary MLOpSupportLimits {
@@ -6818,8 +6824,12 @@ partial dictionary MLOpSupportLimits {
68186824
:: {{MLTensorLimits}} for initialHiddenState operand.
68196825
: <dfn>initialCellState</dfn>
68206826
:: {{MLTensorLimits}} for initialCellState operand.
6821-
: <dfn>outputs</dfn>
6822-
:: {{MLTensorLimits}} for all the output operands.
6827+
: <dfn>output0</dfn>
6828+
:: {{MLTensorLimits}} for all the output operands[0].
6829+
: <dfn>output1</dfn>
6830+
:: {{MLTensorLimits}} for all the output operands[1].
6831+
: <dfn>output2</dfn>
6832+
:: {{MLTensorLimits}} for all the output operands[2].
68236833
</dl>
68246834

68256835
{{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/lstm()}}:
@@ -7083,7 +7093,8 @@ dictionary MLLstmCellSupportLimits {
70837093
MLTensorLimits bias;
70847094
MLTensorLimits recurrentBias;
70857095
MLTensorLimits peepholeWeight;
7086-
MLTensorLimits outputs;
7096+
MLTensorLimits output0;
7097+
MLTensorLimits output1;
70877098
};
70887099

70897100
partial dictionary MLOpSupportLimits {
@@ -7206,8 +7217,10 @@ partial dictionary MLOpSupportLimits {
72067217
:: {{MLTensorLimits}} for recurrentBias operand.
72077218
: <dfn>peepholeWeight</dfn>
72087219
:: {{MLTensorLimits}} for peepholeWeight operand.
7209-
: <dfn>outputs</dfn>
7210-
:: {{MLTensorLimits}} for all the output operands.
7220+
: <dfn>output0</dfn>
7221+
:: {{MLTensorLimits}} for all the output operands[0].
7222+
: <dfn>output1</dfn>
7223+
:: {{MLTensorLimits}} for all the output operands[1].
72117224
</dl>
72127225

72137226
{{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/lstmCell()}}:
@@ -7433,17 +7446,17 @@ partial dictionary MLOpSupportLimits {
74337446
<tr>
74347447
<td>{{a}}</td>
74357448
<td>{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}</td>
7436-
<td>2 or greater</td>
7449+
<td>2 to [=/any rank|N=]</td>
74377450
</tr>
74387451
<tr>
74397452
<td>{{b}}</td>
74407453
<td>[=/same type as|same as=] {{a}}</td>
7441-
<td>2 or greater</td>
7454+
<td>2 or [=/any rank|N=]</td>
74427455
</tr>
74437456
<tr>
74447457
<td>*output*</td>
74457458
<td>[=/same type as|same as=] {{a}}</td>
7446-
<td>maximum of {{a}}'s [=MLOperand/rank=] and {{b}}'s [=MLOperand/rank=]</td>
7459+
<td>2 or [=/any rank|N=]</td>
74477460
</tr>
74487461
</table>
74497462

@@ -7927,7 +7940,7 @@ partial dictionary MLOpSupportLimits {
79277940
<tr>
79287941
<td>*output*</td>
79297942
<td>[=/same type as|same as=] {{input}}</td>
7930-
<td>maximum of {{input}}'s [=MLOperand/rank=] and {{slope}}'s [=MLOperand/rank=]</td>
7943+
<td>[=/any rank|N=]</td>
79317944
</tr>
79327945
</table>
79337946

@@ -8060,7 +8073,7 @@ partial dictionary MLOpSupportLimits {
80608073
<tr>
80618074
<td>*output*</td>
80628075
<td>[=/same type as|same as=] {{input}}</td>
8063-
<td>0 to {{input}}'s [=MLOperand/rank=], depending on {{MLReduceOptions/axes}} and {{MLReduceOptions/keepDimensions}}</td>
8076+
<td>[=/any rank|N=]</td>
80648077
</tr>
80658078
</table>
80668079

@@ -8539,7 +8552,7 @@ partial dictionary MLOpSupportLimits {
85398552
<tr>
85408553
<td>*output*</td>
85418554
<td>[=/same type as|same as=] {{input}}</td>
8542-
<td>{{newShape}}'s [=list/size=]</td>
8555+
<td>[=/any rank|N=]</td>
85438556
</tr>
85448557
</table>
85458558

@@ -8555,6 +8568,7 @@ partial dictionary MLOpSupportLimits {
85558568
</summary>
85568569
1. If [=this=] [=MLGraphBuilder/can not build=], then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}.
85578570
1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}.
8571+
1. If |newShape|'s [=list/size=] is not output tensor's [=/allowed ranks=] (according to [this table](#constraints-reshape)), then [=exception/throw=] a {{TypeError}}.
85588572
1. Let |outputShape| be an empty array of {{unsigned long}}.
85598573
1. If |newShape|'s [=list/size=] is 0, then set |outputShape| to an empty [=/list=] for a scalar.
85608574
1. If any [=list/item=] in |newShape| is not a [=valid dimension=], then [=exception/throw=] a {{TypeError}}.
@@ -8929,7 +8943,7 @@ partial dictionary MLOpSupportLimits {
89298943
<tr>
89308944
<td>{{updates}}</td>
89318945
<td>[=/same type as|same as=] {{input}}</td>
8932-
<td>{{input}}'s [=MLOperand/rank=] + {{indices}}'s [=MLOperand/rank=] - {{indices}}'s [=MLOperand/shape=][-1] - 1</td>
8946+
<td>[=/any rank|N=]</td>
89338947
</tr>
89348948
<tr>
89358949
<td>*output*</td>
@@ -9947,7 +9961,7 @@ partial dictionary MLOpSupportLimits {
99479961
<tr>
99489962
<td>{{input}}</td>
99499963
<td>[=/any data type|any=]</td>
9950-
<td>2 or greater</td>
9964+
<td>2 to [=/any rank|N=]</td>
99519965
</tr>
99529966
<tr>
99539967
<td>*output*</td>
@@ -10102,7 +10116,7 @@ partial dictionary MLOpSupportLimits {
1010210116
<tr>
1010310117
<td>*output*</td>
1010410118
<td>[=/same type as|same as=] {{trueValue}}</td>
10105-
<td>maximum of {{condition}}'s [=MLOperand/rank=], {{trueValue}}'s [=MLOperand/rank=] and {{falseValue}}'s [=MLOperand/rank=]</td>
10119+
<td>[=/any rank|N=]</td>
1010610120
</tr>
1010710121
</table>
1010810122

0 commit comments

Comments
 (0)