From acfa28c339126660b03eca3a8a8de1c4b2cb42e4 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Fri, 15 Nov 2024 10:59:03 -0800 Subject: [PATCH 1/5] Include output operand type/rank in op constraint tables Not referenced normatively, but helpful at-a-glance information. This should be redundant with existing per-op documentation. --- index.bs | 391 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 303 insertions(+), 88 deletions(-) diff --git a/index.bs b/index.bs index 6bb68043..58484fb3 100644 --- a/index.bs +++ b/index.bs @@ -1276,9 +1276,9 @@ The shape [=getter steps=] are to return [=th Since the {{MLOperand/[[builder]]}} object is bound by the {{MLGraphBuilder/constructor()}} constructor to an {{MLContext}} object, an {{MLOperand}} is also always bound to the same {{MLContext}} object. -If an operation supports only a subset of {{MLOperandDataType}}s, the allowed data types for each of the operation's input operands, including both positional arguments and options, are given as either an explicit list of {{MLOperandDataType}}s, or a constraint that the operand's [=MLOperand/dataType=] must be the same type as the [=MLOperand/dataType=] of another input operand, or any to allow any {{MLOperandDataType}}. +If an operation supports only a subset of {{MLOperandDataType}}s, the allowed data types for each of the operation's input operands, including both positional arguments and options, are given as either an explicit list of {{MLOperandDataType}}s, or a constraint that the operand's [=MLOperand/dataType=] must be the same as the [=MLOperand/dataType=] of another input operand, or any to allow any {{MLOperandDataType}}. -If an operation requires input operands with a particular [=MLOperand/rank=], the allowed ranks for each of the operation's input operands, including both positional arguments and options, are given as an explicit rank (e.g. 1), or N to allow any dimensionality. More specific constraints are common, such as when an input operand's shape must be [=/unidirectionally broadcastable=] to or [=/bidirectionally broadcastable=] with another input operand; in these cases, the [=/allowed ranks=] are listed as a range, with specific validation given as steps in the operation. +If an operation requires input operands with a particular [=MLOperand/rank=], the allowed ranks for each of the operation's input operands, including both positional arguments and options, are given as an explicit rank (e.g. 1), or N to allow any dimensionality, or the same as another operand. More specific constraints are common, such as when an input operand's shape must be [=/unidirectionally broadcastable=] to or [=/bidirectionally broadcastable=] with another input operand; in these cases, the [=/allowed ranks=] are listed as a range, with specific validation given as steps in the operation. {{MLOperatorOptions}} has the following members:
@@ -1566,7 +1566,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/argMin()}}/{{MLGraphBuilder/argMax()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -1576,6 +1576,11 @@ partial dictionary MLOpSupportLimits { [=/any data type|any=] [=/any rank|N=] + + *output* + {{MLArgMinMaxOptions/outputDataType}} + 0 to {{input}}'s [=MLOperand/rank=] + {{MLOpSupportLimits}} has the following members for {{MLGraphBuilder/argMin()}} and {{MLGraphBuilder/argMax()}}: @@ -1687,7 +1692,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/batchNormalization()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -1699,24 +1704,29 @@ partial dictionary MLOpSupportLimits { {{mean}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 1 {{variance}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 1 {{MLBatchNormalizationOptions/scale}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 1 {{MLBatchNormalizationOptions/bias}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 1 + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLBatchNormalizationSupportLimits}} has the following members: @@ -1820,7 +1830,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/cast()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -1830,6 +1840,11 @@ partial dictionary MLOpSupportLimits { [=/any data type|any=] [=/any rank|N=] + + *output* + {{type}} + [=/same rank as|same as=] {{input}} + {{MLOpSupportLimits}} has the following members for {{MLGraphBuilder/cast()}}: @@ -1955,7 +1970,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/clamp()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -1965,6 +1980,11 @@ partial dictionary MLOpSupportLimits { [=/any data type|any=] [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/clamp()}}: @@ -2057,16 +2077,21 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/concat()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] - {{inputs}} + {{inputs}}'s [=list/items=] [=/any data type|any=] [=/any rank|N=] + + *output* + [=/same type as|same as=] {{inputs}}'s [=list/items=] + [=/same rank as|same as=] {{inputs}}'s [=list/items=] + {{MLConcatSupportLimits}} has the following members: @@ -2217,7 +2242,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/conv2d()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -2229,14 +2254,19 @@ partial dictionary MLOpSupportLimits { {{filter}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 4 {{MLConv2dOptions/bias}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 1 + + *output* + [=/same type as|same as=] {{input}} + 4 + {{MLConv2dSupportLimits}} has the following members: @@ -2455,7 +2485,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/convTranspose2d()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -2467,14 +2497,19 @@ partial dictionary MLOpSupportLimits { {{filter}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 4 {{MLConv2dOptions/bias}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 1 + + *output* + [=/same type as|same as=] {{input}} + 4 + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/convTranspose2d()}}: @@ -2622,7 +2657,7 @@ partial dictionary MLOpSupportLimits { Constraints for element-wise binary options - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -2634,9 +2669,14 @@ partial dictionary MLOpSupportLimits { {{b}} - [=/same as=] {{a}} + [=/same type as|same as=] {{a}} [=/any rank|N=] + + *output* + [=/same type as|same as=] {{a}} + maximum of {{a}}'s [=MLOperand/rank=] and {{b}}'s [=MLOperand/rank=] + {{MLOpSupportLimits}} has the following members for element-wise binary operations: @@ -2784,7 +2824,7 @@ partial dictionary MLOpSupportLimits { Constraints for element-wise logical options - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -2796,9 +2836,14 @@ partial dictionary MLOpSupportLimits { {{b}} - [=/same as=] {{a}} + [=/same type as|same as=] {{a}} [=/any rank|N=] + + *output* + [=/same type as|same as=] {{a}} + maximum of {{a}}'s [=MLOperand/rank=] and {{b}}'s [=MLOperand/rank=] + @@ -2961,7 +3006,7 @@ partial dictionary MLOpSupportLimits { Constraints for element-wise unary options - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -2971,6 +3016,11 @@ partial dictionary MLOpSupportLimits { specified as part of operation steps [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + @@ -3170,7 +3220,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/elu()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -3180,6 +3230,11 @@ partial dictionary MLOpSupportLimits { {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLOpSupportLimits}} has the following members for {{MLGraphBuilder/elu()}}: @@ -3250,7 +3305,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/expand()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -3260,6 +3315,11 @@ partial dictionary MLOpSupportLimits { [=/any data type|any=] [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + {{newShape}}'s [=list/size=] + {{MLOpSupportLimits}} has the following members for {{MLGraphBuilder/expand()}}: @@ -3334,7 +3394,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/gather()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -3349,6 +3409,11 @@ partial dictionary MLOpSupportLimits { {{MLOperandDataType/"int32"}}, {{MLOperandDataType/"uint32"}}, {{MLOperandDataType/"int64"}} [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + {{input}}'s [=MLOperand/rank=] + {{indices}}'s [=MLOperand/rank=] - 1 + {{MLGatherSupportLimits}} has the following members: @@ -3488,7 +3553,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/gelu()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -3498,6 +3563,11 @@ partial dictionary MLOpSupportLimits { {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/gelu()}}: @@ -3604,7 +3674,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/gemm()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -3616,14 +3686,19 @@ partial dictionary MLOpSupportLimits { {{b}} - [=/same as=] {{a}} + [=/same type as|same as=] {{a}} 2 {{MLGemmOptions/c}} - [=/same as=] {{a}} + [=/same type as|same as=] {{a}} 0 to 2 + + *output* + [=/same type as|same as=] {{a}} + 2 + {{MLGemmSupportLimits}} has the following members: @@ -3806,7 +3881,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/gru()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -3818,29 +3893,34 @@ partial dictionary MLOpSupportLimits { {{weight}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 3 {{recurrentWeight}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 3 {{MLGruOptions/bias}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 2 {{MLGruOptions/recurrentBias}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 2 {{MLGruOptions/initialHiddenState}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 3 + + *outputs* + [=/same type as|same as=] {{input}} + 3 (and 4, if {{MLGruOptions/returnSequence}} is true) + {{MLGruSupportLimits}} has the following members: @@ -4103,7 +4183,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/gruCell()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -4115,24 +4195,29 @@ partial dictionary MLOpSupportLimits { {{weight}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 2 {{recurrentWeight}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 2 {{MLGruCellOptions/bias}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 1 {{MLGruCellOptions/recurrentBias}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 1 + + *output* + [=/same type as|same as=] {{input}} + 2 + {{MLGruCellSupportLimits}} has the following members; @@ -4345,7 +4430,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/hardSigmoid()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -4355,6 +4440,11 @@ partial dictionary MLOpSupportLimits { {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/hardSigmoid()}}: @@ -4425,7 +4515,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/hardSwish()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -4435,6 +4525,11 @@ partial dictionary MLOpSupportLimits { {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/hardSwish()}}: @@ -4540,7 +4635,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/instanceNormalization()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -4552,14 +4647,19 @@ partial dictionary MLOpSupportLimits { {{MLInstanceNormalizationOptions/scale}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 1 {{MLInstanceNormalizationOptions/bias}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 1 + + *output* + [=/same type as|same as=] {{input}} + 4 + {{MLNormalizationSupportLimits}} has the following members: @@ -4689,7 +4789,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/layerNormalization()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -4701,14 +4801,19 @@ partial dictionary MLOpSupportLimits { {{MLLayerNormalizationOptions/scale}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 0 to {{input}}'s [=MLOperand/rank=] {{MLLayerNormalizationOptions/bias}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 0 to {{input}}'s [=MLOperand/rank=] + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/layerNormalization()}}: @@ -4820,7 +4925,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/leakyRelu()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -4830,6 +4935,11 @@ partial dictionary MLOpSupportLimits { {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/leakyRelu()}}: @@ -4913,7 +5023,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/linear()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -4923,6 +5033,11 @@ partial dictionary MLOpSupportLimits { {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/linear()}}: @@ -5067,7 +5182,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/lstm()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -5079,39 +5194,44 @@ partial dictionary MLOpSupportLimits { {{weight}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 3 {{recurrentWeight}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 3 {{MLLstmOptions/bias}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 2 {{MLLstmOptions/recurrentBias}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 2 {{MLLstmOptions/peepholeWeight}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 2 {{MLLstmOptions/initialHiddenState}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 3 {{MLLstmOptions/initialCellState}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 3 + + *outputs* + [=/same type as|same as=] {{input}} + 3 and 3 (and 4 if {{MLLstmOptions/returnSequence}} is true) + {{MLLstmSupportLimits}} has the following members: @@ -5418,7 +5538,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/lstmCell()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -5430,39 +5550,44 @@ partial dictionary MLOpSupportLimits { {{weight}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 2 {{recurrentWeight}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 2 {{hiddenState}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 2 {{cellState}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 2 {{MLLstmCellOptions/bias}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 1 {{MLLstmCellOptions/recurrentBias}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 1 {{MLLstmCellOptions/peepholeWeight}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} 1 + + *outputs* + [=/same type as|same as=] {{input}} + 2 and 2 + {{MLLstmCellSupportLimits}} has the following members: @@ -5702,7 +5827,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/matmul()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -5714,9 +5839,14 @@ partial dictionary MLOpSupportLimits { {{b}} - [=/same as=] {{a}} + [=/same type as|same as=] {{a}} 2 or greater + + *output* + [=/same type as|same as=] {{a}} + maximum of {{a}}'s [=MLOperand/rank=] and {{b}}'s [=MLOperand/rank=] + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/matmul()}}: @@ -5819,7 +5949,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/pad()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -5829,6 +5959,11 @@ partial dictionary MLOpSupportLimits { [=/any data type|any=] [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/pad()}}: @@ -6014,7 +6149,7 @@ partial dictionary MLOpSupportLimits { Constraints for pooling operations - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -6024,6 +6159,11 @@ partial dictionary MLOpSupportLimits { specified as part of operation steps 4 + + *output* + [=/same type as|same as=] {{input}} + 4 + {{MLOpSupportLimits}} has the following members for pooling operations: @@ -6186,7 +6326,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/prelu()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -6197,9 +6337,14 @@ partial dictionary MLOpSupportLimits { [=/any rank|N=] {{slope}} - [=/same as=] {{input}} + [=/same type as|same as=] {{input}} [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLPreluSupportLimits}} has the following members: @@ -6318,7 +6463,7 @@ partial dictionary MLOpSupportLimits { Constraints for reduction-operations - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -6328,6 +6473,11 @@ partial dictionary MLOpSupportLimits { specified as part of operation steps [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + 0 to {{input}}'s [=MLOperand/rank=], depending on {{MLReduceOptions/axes}} and {{MLReduceOptions/keepDimensions}} + {{MLOpSupportLimits}} has the following members for reduction operations: @@ -6531,7 +6681,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/relu()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -6541,6 +6691,11 @@ partial dictionary MLOpSupportLimits { {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}, {{MLOperandDataType/"int32"}}, {{MLOperandDataType/"int8"}} [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/relu()}}: @@ -6637,7 +6792,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/resample2d()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -6647,6 +6802,11 @@ partial dictionary MLOpSupportLimits { {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} 4 + + *output* + [=/same type as|same as=] {{input}} + 4 + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/resample2d()}}: @@ -6730,7 +6890,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/reshape()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -6740,6 +6900,11 @@ partial dictionary MLOpSupportLimits { [=/any data type|any=] [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + {{newShape}}'s [=list/size=] + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/reshape()}}: @@ -6796,7 +6961,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/sigmoid()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -6806,6 +6971,11 @@ partial dictionary MLOpSupportLimits { {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/sigmoid()}}: @@ -6874,7 +7044,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/slice()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -6884,6 +7054,11 @@ partial dictionary MLOpSupportLimits { [=/any data type|any=] [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/slice()}}: @@ -6945,7 +7120,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/softmax()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -6955,6 +7130,11 @@ partial dictionary MLOpSupportLimits { {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/softmax()}}: @@ -7028,7 +7208,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/softplus()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -7038,6 +7218,11 @@ partial dictionary MLOpSupportLimits { {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/softplus()}}: @@ -7116,7 +7301,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/softsign()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -7126,6 +7311,11 @@ partial dictionary MLOpSupportLimits { {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/softsign()}}: @@ -7194,7 +7384,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/split()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -7204,6 +7394,11 @@ partial dictionary MLOpSupportLimits { [=/any data type|any=] [=/any rank|N=] + + *outputs* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLSplitSupportLimits}} has the following members: @@ -7304,7 +7499,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/tanh()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -7314,6 +7509,11 @@ partial dictionary MLOpSupportLimits { {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/tanh()}}: @@ -7394,7 +7594,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/transpose()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -7404,6 +7604,11 @@ partial dictionary MLOpSupportLimits { [=/any data type|any=] [=/any rank|N=] + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/transpose()}}: @@ -7472,7 +7677,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/triangular()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -7482,6 +7687,11 @@ partial dictionary MLOpSupportLimits { [=/any data type|any=] 2 or greater + + *output* + [=/same type as|same as=] {{input}} + [=/same rank as|same as=] {{input}} + {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/triangular()}}: @@ -7606,7 +7816,7 @@ partial dictionary MLOpSupportLimits { Constraints for {{MLGraphBuilder/where()}} - input operand + operand [=/allowed data types=] [=/allowed ranks=] @@ -7623,9 +7833,14 @@ partial dictionary MLOpSupportLimits { {{falseValue}} - [=/same as=] {{trueValue}} + [=/same type as|same as=] {{trueValue}} [=/any rank|N=] + + *output* + [=/same type as|same as=] {{trueValue}} + maximum of {{trueValue}}'s [=MLOperand/rank=] and {{falseValue}}'s [=MLOperand/rank=] + {{MLWhereSupportLimits}} has the following members: From 33a1ac5f30f69ea15dde8695fb036e5f7c200520 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Mon, 18 Nov 2024 10:36:26 -0800 Subject: [PATCH 2/5] Apply suggestions from code review Co-authored-by: Dwayne Robinson --- index.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index 58484fb3..3cfbb462 100644 --- a/index.bs +++ b/index.bs @@ -1579,7 +1579,7 @@ partial dictionary MLOpSupportLimits { *output* {{MLArgMinMaxOptions/outputDataType}} - 0 to {{input}}'s [=MLOperand/rank=] + {{input}}'s [=MLOperand/rank=] - 1 to {{input}}'s [=MLOperand/rank=] @@ -6343,7 +6343,7 @@ partial dictionary MLOpSupportLimits { *output* [=/same type as|same as=] {{input}} - [=/same rank as|same as=] {{input}} + maximum of {{input}}'s [=MLOperand/rank=] and {{slope}}'s [=MLOperand/rank=] From 293e02a320fd3c2fd8129c3d4e487d36af0b1f1f Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Mon, 18 Nov 2024 19:43:30 +0000 Subject: [PATCH 3/5] Split up ranks for multiple outputs --- index.bs | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/index.bs b/index.bs index 3cfbb462..6eb73670 100644 --- a/index.bs +++ b/index.bs @@ -3917,9 +3917,14 @@ partial dictionary MLOpSupportLimits { 3 - *outputs* + *outputs[0]* + [=/same type as|same as=] {{input}} + 3 + + + *outputs[1]* if {{MLGruOptions/returnSequence}} is true [=/same type as|same as=] {{input}} - 3 (and 4, if {{MLGruOptions/returnSequence}} is true) + 4 @@ -5228,9 +5233,19 @@ partial dictionary MLOpSupportLimits { 3 - *outputs* + *outputs[0]* + [=/same type as|same as=] {{input}} + 3 + + + *outputs[1]* [=/same type as|same as=] {{input}} - 3 and 3 (and 4 if {{MLLstmOptions/returnSequence}} is true) + 3 + + + *outputs[2]* if {{MLLstmOptions/returnSequence}} is true + [=/same type as|same as=] {{input}} + 4 @@ -5584,9 +5599,14 @@ partial dictionary MLOpSupportLimits { 1 - *outputs* + *outputs[0]* [=/same type as|same as=] {{input}} - 2 and 2 + 2 + + + *outputs[1]* + [=/same type as|same as=] {{input}} + 2 From 381bc209616ed83eab4f4e55754af7156bdd768b Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Tue, 19 Nov 2024 12:43:27 -0800 Subject: [PATCH 4/5] Update index.bs Co-authored-by: Ningxin Hu --- index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.bs b/index.bs index 6eb73670..6d5dcdb0 100644 --- a/index.bs +++ b/index.bs @@ -7859,7 +7859,7 @@ partial dictionary MLOpSupportLimits { *output* [=/same type as|same as=] {{trueValue}} - maximum of {{trueValue}}'s [=MLOperand/rank=] and {{falseValue}}'s [=MLOperand/rank=] + maximum of {{condition}}'s [=MLOperand/rank=], {{trueValue}}'s [=MLOperand/rank=] and {{falseValue}}'s [=MLOperand/rank=] From ab327cae116144297287bb66b1d32348380c1c64 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Tue, 19 Nov 2024 12:50:53 -0800 Subject: [PATCH 5/5] Fix var typo / add lint check --- index.bs | 2 +- tools/lint.mjs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index 58484fb3..379661c3 100644 --- a/index.bs +++ b/index.bs @@ -7871,7 +7871,7 @@ partial dictionary MLOpSupportLimits { 1. If the [=MLOperand/dataType=] of any of |condition|, |trueValue|, or |falseValue| is not one of its [=/allowed data types=] (according to [this table](#constraints-where)), then [=exception/throw=] a {{TypeError}}. 1. Let |outputShape| be the result of [=bidirectionally broadcasting=] |trueValue|'s [=MLOperand/shape=] and |falseValue|'s [=MLOperand/shape=]. 1. If that returns failure, then [=exception/throw=] a {{TypeError}}. - 1. Set |outputShape| to the result of [=bidirectionally broadcasting=] |condition|'s [=MLOperand/shape=] and |outputShape]. + 1. Set |outputShape| to the result of [=bidirectionally broadcasting=] |condition|'s [=MLOperand/shape=] and |outputShape|. 1. If that returns failure, then [=exception/throw=] a {{TypeError}}. 1. Let |descriptor| be the result of [=creating an MLOperandDescriptor=] given |trueValue|'s [=MLOperand/dataType=] and |outputShape|. 1. *Make graph connections:* diff --git a/tools/lint.mjs b/tools/lint.mjs index 787c3121..cf35684c 100755 --- a/tools/lint.mjs +++ b/tools/lint.mjs @@ -186,14 +186,19 @@ for (const element of root.querySelectorAll('.idl dfn[data-dfn-type=dict-member] error(`Dictionary member missing dfn: ${element.innerText}`); } -// Look for [] used in algorithm steps for anything but indexing, slots, and refs +// Look for suspicious stuff in algorithm steps for (const element of root.querySelectorAll(ALGORITHM_STEP_SELECTOR)) { + // [] used for anything but indexing, slots, and refs // Exclude \w[ for indexing (e.g. shape[n]) // Exclude [[ for inner slots (e.g. [[name]]) // Exclude [A for references (e.g. [WEBIDL]) for (const match of element.innerText.matchAll(/(?