From 7f2e78beaf0d66d81eed4bc3dd6fadfad86db663 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Fri, 26 Apr 2024 17:23:06 -0700 Subject: [PATCH 01/20] Make operand data type and rank validation table-driven Improve readability of input operand data type and rank by introducing a table within each method definition that outlines the restrictions for positional arguments and options. Steps are updated to reference the table columns. --- index.bs | 716 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 630 insertions(+), 86 deletions(-) diff --git a/index.bs b/index.bs index 0bd93e74..755b781d 100644 --- a/index.bs +++ b/index.bs @@ -1105,6 +1105,11 @@ An {{MLOperand}}'s dataType is its {{MLOperand/[[descri 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 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. + + ### Creating an {{MLOperand}} ### {#api-mloperand-create} The {{MLOperand}} objects are created by the methods of {{MLGraphBuilder}}, internally using the following algorithms. @@ -1553,27 +1558,57 @@ partial interface MLGraphBuilder { **Returns:** an {{MLOperand}}. The batch-normalized N-D tensor of the same shape as *input*. + + + + + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + [=/any rank|N=] +
{{mean}} + [=/same as=] {{input}} + 1 +
{{variance}} + [=/same as=] {{input}} + 1 +
{{MLBatchNormalizationOptions/scale}} + [=/same as=] {{input}} + 1 +
{{MLBatchNormalizationOptions/bias}} + [=/same as=] {{input}} + 1 +
+ +
The batchNormalization(|input|, |mean|, |variance|, |options|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |mean|, |variance|, |options|.{{MLBatchNormalizationOptions/scale}} (if it [=map/exists=]), and |options|.{{MLBatchNormalizationOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLBatchNormalizationOptions/activation}} [=map/exists=], and [=MLGraphBuilder/validating activation=] with [=this=] and it returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLBatchNormalizationOptions/axis}} is not in [=the range=] 0 to |input|'s [=MLOperand/rank=], exclusive, then [=exception/throw=] a {{TypeError}}. - 1. If |mean|'s [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. - 1. If |mean|'s [=MLOperand/rank=] is not 1, then [=exception/throw=] a {{TypeError}}. + 1. If |mean|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |mean|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If |mean|'s [=MLOperand/shape=][0] is not equal to |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}], then [=exception/throw=] a {{TypeError}}. - 1. If |variance|'s [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. - 1. If |variance|'s [=MLOperand/rank=] is not 1, then [=exception/throw=] a {{TypeError}}. + 1. If |variance|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |variance|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If |variance|'s [=MLOperand/shape=][0] is not equal to |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLBatchNormalizationOptions/scale}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not 1, then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][0] is not equal to |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLBatchNormalizationOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not 1, then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][0] is not equal to |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLBatchNormalizationOptions/activation}} [=map/exists=], and running its [=MLActivation/validation steps=]] with |input|.{{MLOperand/[[descriptor]]}} returns false, then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* @@ -1881,6 +1916,28 @@ partial interface MLGraphBuilder { *outputSize = 1 + (inputSize - (filterSize - 1) ** *dilation - 1 + beginningPadding + endingPadding) / stride* + + + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + 4 +
{{filter}} + [=/same as=] {{input}} + 4 +
{{MLConv2dOptions/bias}} + {{input}} + 1 +
+ +
A *depthwise* conv2d operation is a variant of grouped convolution, used in models like the MobileNet, where the *options.groups* = inputChannels = outputChannels and the shape of filter tensor is [options.groups, 1, height, width] for {{MLConv2dFilterOperandLayout/"oihw"}} layout, [height, width, 1, options.groups] for {{MLConv2dFilterOperandLayout/"hwio"}} layout, [options.groups, height, width, 1] for {{MLConv2dFilterOperandLayout/"ohwi"}} layout and [1, height, width, options.groups] for {{MLConv2dFilterOperandLayout/"ihwo"}} layout. @@ -1910,10 +1967,10 @@ partial interface MLGraphBuilder { 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |filter|, and |options|.{{MLConv2dOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConv2dOptions/activation}} [=map/exists=], and [=MLGraphBuilder/validating activation=] with [=this=] and it returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/rank=] is not 4, then [=exception/throw=] a {{TypeError}}. - 1. If |filter|'s [=MLOperand/rank=] is not 4, then [=exception/throw=] a {{TypeError}}. - 1. If |filter|'s [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. + 1. If |filter|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |filter|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConv2dOptions/padding}} does not [=map/exist=], set it to the [=/list=] « 0, 0, 0, 0 ». 1. Else if |options|.{{MLConv2dOptions/padding}}'s [=list/size=] is not 4, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConv2dOptions/strides}} does not [=map/exist=], set it to the [=/list=] « 1, 1 ». @@ -1969,9 +2026,9 @@ partial interface MLGraphBuilder { 1. If |inputChannels| % |options|.{{MLConv2dOptions/groups}} is not 0, then [=exception/throw=] a {{TypeError}}. 1. Else if |inputChannels| / |options|.{{MLConv2dOptions/groups}} is not equal to |filterInputChannels|, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConv2dOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/rank=] is not 1, then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=, then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][0] is not equal to |outputChannels|, then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. 1. Let |outputSizes| be the result of [=MLGraphBuilder/calculating conv2d output sizes=] given |inputHeight|, |inputWidth|, |filterHeight|, |filterWidth|, |options|.{{MLConv2dOptions/padding}}, |options|.{{MLConv2dOptions/strides}}, and |options|.{{MLConv2dOptions/dilations}}. 1. Switch on |options|.{{MLConv2dOptions/inputLayout}}:
@@ -2103,6 +2160,28 @@ partial interface MLGraphBuilder { *outputSize = (inputSize - 1) ** *stride + (filterSize - 1) ** *dilation + 1 - beginningPadding - endingPadding + outputPadding*
+ + + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + 4 +
{{filter}} + [=/same as=] {{input}} + 4 +
{{MLConv2dOptions/bias}} + {{input}} + 1 +
+ +
To calculate convtranspose output size given unsigned integers |inputSize|, |filterSize|, |beginningPadding|, |endingPadding|, |stride|, |dilation|, and |outputPadding|, perform these steps. They return a number. @@ -2127,10 +2206,10 @@ partial interface MLGraphBuilder { 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |filter|, and |options|.{{MLConvTranspose2dOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConvTranspose2dOptions/activation}} [=map/exists=], and [=MLGraphBuilder/validating activation=] with [=this=] and it returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/rank=] is not 4, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. - 1. If |filter|'s [=MLOperand/rank=] is not 4, then [=exception/throw=] a {{TypeError}}. - 1. If |filter|'s [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. + 1. If |filter|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |filter|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConvTranspose2dOptions/padding}} does not [=map/exist=], set it to the [=/list=] « 0, 0, 0, 0 ». 1. Else if |options|.{{MLConvTranspose2dOptions/padding}}'s [=list/size=] is not 4, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConvTranspose2dOptions/strides}} does not [=map/exist=], set it to the [=/list=] « 1, 1 ». @@ -2185,9 +2264,9 @@ partial interface MLGraphBuilder { 1. If |inputChannels| is not equal to |filterInputChannels|, then [=exception/throw=] a {{TypeError}}. 1. Let |outputChannels| be |filterOutputChannels| * |options|.{{MLConvTranspose2dOptions/groups}} 1. If |options|.{{MLConvTranspose2dOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/rank=] is not 1, then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][0] is not equal to |outputChannels|, then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConvTranspose2dOptions/outputSizes}} [=map/exists=], let |outputSizes| be |options|.{{MLConvTranspose2dOptions/outputSizes}}. 1. Else let |outputSizes| be the result of [=MLGraphBuilder/calculating convtranspose2d output sizes=] given |inputHeight|, |inputWidth|, |filterHeight|, |filterWidth|, |options|.{{MLConvTranspose2dOptions/padding}}, |options|.{{MLConvTranspose2dOptions/strides}}, |options|.{{MLConvTranspose2dOptions/dilations}}, and |options|.{{MLConvTranspose2dOptions/outputPadding}}. 1. Switch on |options|.{{MLConvTranspose2dOptions/inputLayout}}: @@ -2641,12 +2720,26 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + [=/any rank|N=] +
+ +
The elu(|input|, |options|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the ELU operation, given |options|. @@ -2740,12 +2833,30 @@ partial interface MLGraphBuilder { The {{MLGraphBuilder/gather(input, indices, options)/indices}} parameter to {{MLGraphBuilder/gather()}} can not be clamped to the allowed range when the graph is built because the inputs are not known until execution. Implementations can introduce {{MLGraphBuilder/clamp()}} in the compiled graph if the required clamping behavior is not provided by the underlying platform. Similarly, if the underlying platform does not support negative indices, the implementation can introduce operations in the compiled graph to transform a negative index from the end of the dimension into a positive index. + + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + [=/any data type|any=] + [=/any rank|N=] +
{{indices}} + {{MLOperandDataType/"uint32"}}, {{MLOperandDataType/"int64"}} + [=/any rank|N=] +
+ +
The gather(|input|, |indices|, |options|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input| and |indices| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |indices|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"uint32"}} or {{MLOperandDataType/"int64"}}, then [=exception/throw=] a {{TypeError}}. + 1. If |indices|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. Let |shapeInput| be |input|'s [=MLOperand/shape=] and |rankInput| be |shapeInput|'s [=MLOperand/rank=]. 1. Let |shapeIndices| be |indices|'s [=MLOperand/shape=]. 1. Let |axis| be |options|.{{MLGatherOptions/axis}}. @@ -2872,12 +2983,26 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + [=/any rank|N=] +
+ +
The gelu(|input|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the gelu operation. @@ -2953,13 +3078,35 @@ partial interface MLGraphBuilder { **Returns:** an {{MLOperand}}. The output 2-D tensor of shape [M, N] that contains the calculated product of all the inputs. + + + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{a}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + [=/any rank|N=] +
{{b}} + [=/same as=] {{a}} + [=/any rank|N=] +
{{MLGemmOptions/c}} + [=/same as=] {{a}} + [=/any rank|N=] +
+ +
The gemm(|a|, |b|, |options|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |a| and |b| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |a|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. - 1. If |b|'s [=MLOperand/dataType=] is not equal to |a|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. + 1. If |a|'s [=MLOperand/dataType=] is one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |b|'s [=MLOperand/dataType=] is one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |a|'s [=MLOperand/rank=] is not 2 or |b|'s [=MLOperand/rank=] is not 2, then [=exception/throw=] a {{TypeError}}. 1. Let |shapeA| be a [=list/clone=] of |a|'s [=MLOperand/shape=]. 1. Let |shapeB| be a [=list/clone=] of |b|'s [=MLOperand/shape=]. @@ -2968,7 +3115,7 @@ partial interface MLGraphBuilder { 1. If |shapeA|[1] is not equal to |shapeB|[0], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGemmOptions/c}} [=map/exists=]: 1. If it is not [=unidirectionally broadcastable=] to the shape « |shapeA|[0], |shapeB|[1] », then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/dataType=] is not equal to |a|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. Let |desc| be a new {{MLOperandDescriptor}}. 1. Set |desc|.{{MLOperandDescriptor/dimensions}} to the [=/list=] « |shapeA|[0], |shapeB|[1] ». 1. Set |desc|.{{MLOperandDescriptor/dataType}} to |a|'s [=MLOperand/dataType=]. @@ -3083,24 +3230,59 @@ partial interface MLGraphBuilder { **Returns:** a sequence of {{MLOperand}}. The first element of the sequence is a 3-D tensor of shape [numDirections, batchSize, hiddenSize], the cell output from the last time step of the network. Additionally, if |options|.{{MLGruOptions/returnSequence}} is set to true, the second element is the 4-D output tensor of shape [steps, numDirections, batchSize, hiddenSize] containing every cell outputs from each time step in the temporal sequence. + + + + + + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + 3 +
{{weight}} + [=/same as=] {{input}} + 3 +
{{recurrentWeight}} + [=/same as=] {{input}} + 3 +
{{MLGruOptions/bias}} + [=/same as=] {{input}} + 2 +
{{MLGruOptions/recurrentBias}} + [=/same as=] {{input}} + 2 +
{{MLGruOptions/initialHiddenState}} + [=/same as=] {{input}} + 3 +
+ +
The gru(|input|, |weight|, |recurrentWeight|, |steps|, |hiddenSize|, |options|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |weight|, |recurrentWeight|, |options|.{{MLGruOptions/bias}} (if it [=map/exists=]), |options|.{{MLGruOptions/recurrentBias}} (if it [=map/exists=]), and |options|.{{MLGruOptions/initialHiddenState}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruOptions/activations}} [=map/exists=], and [=MLGraphBuilder/validating activation=] with [=this=] and any [=list/item=] in it returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/rank=] of any of |input|, |weight| or |recurrentWeight| is not 3, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of either |weight| or |recurrentWeight| is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of either |input|, |weight| or |recurrentWeight| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/rank=] of any of |input|, |weight| or |recurrentWeight| is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][1] is not equal to 3 * |hiddenSize|, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruOptions/recurrentBias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][1] is not equal to 3 * |hiddenSize|, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruOptions/initialHiddenState}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not 3, then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruOptions/activations}} [=map/exists=] and its [=list/size=] is not 2, then [=exception/throw=] a {{TypeError}}. 1. If |steps| is not equal to |input|'s [=MLOperand/shape=][0], then [=exception/throw=] a {{TypeError}}. 1. Let |batchSize| be |input|'s [=MLOperand/shape=][1]. @@ -3263,23 +3445,52 @@ partial interface MLGraphBuilder { **Returns:** an {{MLOperand}}. The 2-D tensor of shape [batchSize, hiddenSize], the cell output hidden state of a single time step of the recurrent network. + + + + + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + 2 +
{{weight}} + [=/same as=] {{input}} + 2 +
{{recurrentWeight}} + [=/same as=] {{input}} + 2 +
{{MLGruCellOptions/bias}} + [=/same as=] {{input}} + 1 +
{{MLGruCellOptions/recurrentBias}} + [=/same as=] {{input}} + 1 +
+ +
The gruCell(|input|, |weight|, |recurrentWeight|, |hiddenState|, |hiddenSize|, |options|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |weight|, |recurrentWeight|, |hiddenState|, |options|.{{MLGruCellOptions/bias}} (if it [=map/exists=]), and |options|.{{MLGruCellOptions/recurrentBias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruCellOptions/activations}} [=map/exists=], and [=MLGraphBuilder/validating activation=] with [=this=] and any [=list/item=] in it returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/rank=] of any of |input|, |weight|, |recurrentWeight| or |hiddenState| is not 2, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of any of |weight|, |recurrentWeight|, or |hiddenState| is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |input|, |weight|, |recurrentWeight|, or |hiddenState| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/rank=] of any of |input|, |weight|, |recurrentWeight| or |hiddenState| is not its [=allowed ranks=], then [=exception/throw=] a {{TypeError}}. 1. If |weight|'s [=MLOperand/shape=][0] is not equal to 3 * |hiddenSize|, then [=exception/throw=] a {{TypeError}}. 1. If |recurrentWeight|'s [=MLOperand/shape=][0] is not equal to 3 * |hiddenSize|, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not equal to 3 * |hiddenSize|, then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/shape=] is not equal to « 3 * |hiddenSize|, |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruOptions/recurrentBias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not equal to 3 * |hiddenSize|, then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/shape=] is not equal to « 3 * |hiddenSize|, |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruOptions/activations}} [=map/exists=] and its [=list/size=] is not 2, then [=exception/throw=] a {{TypeError}}. 1. Let |desc| be a new {{MLOperandDescriptor}}. 1. Set |desc|.{{MLOperandDescriptor/dimensions}} to the [=/list=] « |input|'s [=MLOperand/shape=][0], |hiddenSize| ». @@ -3449,12 +3660,26 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + [=/any rank|N=] +
+ +
The hardSigmoid(|input|, |options|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the hard sigmoid operation, given |options|. @@ -3518,12 +3743,26 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + [=/any rank|N=] +
+ +
The hardSwish(|input|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the hard-swish operation. @@ -3596,19 +3835,41 @@ partial interface MLGraphBuilder { **Returns:** an {{MLOperand}}. The instance-normalized 4-D tensor of the same shape as *input*. + + + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + 4 +
{{MLInstanceNormalizationOptions/scale}} + {{input}} + 1 +
{{MLInstanceNormalizationOptions/bias}} + {{input}} + 1 +
+ +
The instanceNormalization(|input|, |options|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |options|.{{MLInstanceNormalizationOptions/scale}} (if it [=map/exists=]), and |options|.{{MLInstanceNormalizationOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/rank=] is not 4, then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLInstanceNormalizationOptions/scale}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not equal to 1, then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLInstanceNormalizationOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not equal to 1, then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the instance normalization operation, given |options|. @@ -3697,18 +3958,40 @@ partial interface MLGraphBuilder { **Returns:** an {{MLOperand}}. The layer-normalized N-D tensor of the same shape as *input*. + + + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + [=/any rank|N=] +
{{MLLayerNormalizationOptions/scale}} + {{input}} + [=/any rank|N=] +
{{MLLayerNormalizationOptions/bias}} + {{input}} + [=/any rank|N=] +
+ +
The layerNormalization(|input|, |options|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |options|.{{MLLayerNormalizationOptions/scale}} (if it [=map/exists=]), and |options|.{{MLLayerNormalizationOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLayerNormalizationOptions/axes}} does not [=map/exist=], then set |options|.{{MLLayerNormalizationOptions/axes}} to a new [=/list=], either equal to [=the range=] from 1 to |input|'s [=MLOperand/rank=], exclusive, if |input|'s [=MLOperand/rank=] is greater than 1, or an empty [=/list=] otherwise. 1. If |options|.{{MLLayerNormalizationOptions/scale}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/rank=] is not equal to |options|.{{MLLayerNormalizationOptions/axes}}'s [=list/size=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLayerNormalizationOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/rank=] is not equal to |options|.{{MLLayerNormalizationOptions/axes}}'s [=list/size=], then [=exception/throw=] a {{TypeError}}. 1. [=list/For each=] |index| in [=the range=] 0 to |options|.{{MLLayerNormalizationOptions/axes}}'s [=list/size=], exclusive: 1. Let |axis| be |options|.{{MLLayerNormalizationOptions/axes}}[|index|]. @@ -3805,12 +4088,26 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + [=/any rank|N=] +
+ +
The leakyRelu(|input|, |options|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the Leaky RELU operation, given |options|. @@ -3885,12 +4182,25 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + [=/any rank|N=] +
+
The linear(|input|, |options|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the linear operation, given |options|. @@ -3999,6 +4309,48 @@ partial interface MLGraphBuilder { **Returns:** a sequence of {{MLOperand}}. The first element of the sequence is a 3-D tensor of shape [numDirections, batchSize, hiddenSize], the output hidden state from the last time step of the network. The second element is a 3-D tensor of shape [numDirections, batchSize, hiddenSize], the output cell state from the last time step of the network. Additionally, if |options|.{{MLLstmOptions/returnSequence}} is set to true, the third element is the 4-D output tensor of shape [steps, numDirections, batchSize, hiddenSize] containing every output from each time step in the temporal sequence. + + + + + + + + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + 3 +
{{weight}} + [=/same as=] {{input}} + 3 +
{{recurrentWeight}} + [=/same as=] {{input}} + 3 +
{{MLLstmOptions/bias}} + [=/same as=] {{input}} + 2 +
{{MLLstmOptions/recurrentBias}} + [=/same as=] {{input}} + 2 +
{{MLLstmOptions/peepholeWeight}} + [=/same as=] {{input}} + 2 +
{{MLLstmOptions/initialHiddenState}} + [=/same as=] {{input}} + 3 +
{{MLLstmOptions/initialCellState}} + [=/same as=] {{input}} + 3 +
+ +
The lstm(|input|, |weight|, |recurrentWeight|, |steps|, |hiddenSize|, |options|) method steps are: @@ -4006,35 +4358,34 @@ partial interface MLGraphBuilder { 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |weight|, |recurrentWeight|, |options|.{{MLLstmOptions/bias}} (if it [=map/exists=]), |options|.{{MLLstmOptions/recurrentBias}} (if it [=map/exists=]), |options|.{{MLLstmOptions/peepholeWeight}} (if it [=map/exists=]), |options|.{{MLLstmOptions/initialHiddenState}} (if it [=map/exists=]), and |options|.{{MLLstmOptions/initialCellState}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/activations}} [=map/exists=], and [=MLGraphBuilder/validating activation=] with [=this=] and any [=list/item=] in it returns false, then [=exception/throw=] a {{TypeError}}. 1. Let |numDirections| be 2 if |options|.{{MLLstmOptions/direction}} is {{MLRecurrentNetworkDirection/"both"}}, or 1 otherwise. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |input|, |weight| or |recurrentWeight| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If the [=MLOperand/rank=] of any of |input|, |weight| or |recurrentWeight| is not 3, then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/shape=][0] is not equal to |steps|, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of either |weight| or |recurrentWeight| is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. 1. Let |batchSize| be |input|'s [=MLOperand/shape=][1]. 1. If |options|.{{MLLstmOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not 2, then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][0] is not |numDirections|, then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][1] is not 4 * |hiddenSize|, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/recurrentBias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not 2, then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][0] is not |numDirections|, then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][1] is not 4 * |hiddenSize|, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/peepholeWeight}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not 2, then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][0] is not |numDirections|, then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][1] is not 4 * |hiddenSize|, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/initialHiddenState}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not 3, then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][0] is not |numDirections|, then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][1] is not equal to |batchSize|, then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][2] is not |hiddenSize|, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/initialCellState}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not 3, then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][0] is not |numDirections|, then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][1] is not equal to |batchSize|, then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][2] is not |hiddenSize|, then [=exception/throw=] a {{TypeError}}. @@ -4218,27 +4569,68 @@ partial interface MLGraphBuilder { **Returns:** a sequence of {{MLOperand}}. The first element of the sequence is the output hidden state of the current time step of the recurrent network. The following element is the output cell state. Both elements are 2-D tensors of shape [batchSize, hiddenSize]. + + + + + + + + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + 2 +
{{weight}} + [=/same as=] {{input}} + 2 +
{{recurrentWeight}} + [=/same as=] {{input}} + 2 +
{{hiddenState}} + [=/same as=] {{input}} + 2 +
{{cellState}} + [=/same as=] {{input}} + 2 +
{{MLLstmCellOptions/bias}} + [=/same as=] {{input}} + 1 +
{{MLLstmCellOptions/recurrentBias}} + [=/same as=] {{input}} + 1 +
{{MLLstmCellOptions/peepholeWeight}} + [=/same as=] {{input}} + 1 +
+ +
The lstmCell(|input|, |weight|, |recurrentWeight|, |hiddenState|, |cellState|, |hiddenSize|, |options|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |weight|, |recurrentWeight|, |hiddenState|, |cellState|, |options|.{{MLLstmCellOptions/bias}} (if it [=map/exists=]), |options|.{{MLLstmCellOptions/recurrentBias}} (if it [=map/exists=]), and |options|.{{MLLstmCellOptions/peepholeWeight}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmCellOptions/activations}} [=map/exists=], and [=MLGraphBuilder/validating activation=] with [=this=] and any [=list/item=] in it returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/rank=] of any of |input|, |weight|, |recurrentWeight|, |hiddenState| or |cellState| is not 2, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of any of |weight|, |recurrentWeight|, |hiddenState| or |cellState| is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |input|, |weight|, |recurrentWeight|, |hiddenState| or |cellState| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/rank=] of any of |input|, |weight|, |recurrentWeight|, |hiddenState| or |cellState| is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. Let |batchSize| be |input|'s [=MLOperand/shape=][0]. 1. If |options|.{{MLLstmCellOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not 1, then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][0] is not 4 * |hiddenSize|, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmCellOptions/recurrentBias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not 1, then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][0] is not 4 * |hiddenSize|, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmCellOptions/peepholeWeight}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not equal to |input|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not 1, then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][0] is not 3 * |hiddenSize|, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmCellOptions/activations}} [=map/exists=]: 1. If its [=list/size=] is not 3, then [=exception/throw=] a {{TypeError}}. @@ -4401,6 +4793,24 @@ partial interface MLGraphBuilder { - If either *a* or *b* is `N`-dimensional where `N > 2`, it is treated as a stack of matrices with dimensions corresponding to the last two indices. The matrix multiplication will be broadcasted accordingly by following the [[!numpy-broadcasting-rule]]. The output is a `N`-dimensional tensor whose rank is the maximum [=MLOperand/rank=] of the input tensors. For each dimension, except the last two, of the output tensor, its size is the maximum size along that dimension of the input tensors. + + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{a}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + 2 or greater +
{{b}} + [=/same as=] {{a}} + 2 or greater +
+ +
To calculate matmul output sizes, given {{MLOperand}} |a| and {{MLOperand}} |b| run the following steps: @@ -4427,7 +4837,7 @@ partial interface MLGraphBuilder { The matmul(|a|, |b|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |a| and |b| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |a|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. + 1. If |a|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}., 1. If |b|'s [=MLOperand/dataType=] is not equal to |a|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. 1. Let |desc| be a new {{MLOperandDescriptor}}. 1. Set |desc|.{{MLOperandDescriptor/dimensions}} to the result of [=MLGraphBuilder/calculating matmul output sizes=] given |a| and |b|. @@ -4791,12 +5201,26 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}, {{MLOperandDataType/"int32"}}, {{MLOperandDataType/"int8"}} + [=/any rank|N=] +
+ +
The prelu(|input|, |slope|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}, {{MLOperandDataType/"int32"}}, or {{MLOperandDataType/"int8"}}, then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}., 1. Let |descriptor| be a new {{MLOperandDescriptor}}. 1. Set |descriptor|.{{MLOperandDescriptor/dataType}} to |input|'s [=MLOperand/dataType=]. 1. Set |descriptor|.{{MLOperandDescriptor/dimensions}} to the result of [=unidirectionally broadcasting the shapes=] |slope|'s [=MLOperand/shape=] and |input|'s [=MLOperand/shape=]. @@ -5042,12 +5466,26 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}, {{MLOperandDataType/"int32"}}, {{MLOperandDataType/"int8"}} + [=/any rank|N=] +
+ +
The relu(|input|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}, {{MLOperandDataType/"int32"}}, or {{MLOperandDataType/"int8"}}, then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the ReLU operation. @@ -5125,6 +5563,20 @@ partial interface MLGraphBuilder { The default value is [2, 3]. + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + 4 +
+ +
To check resample options given |options|, run the following steps: @@ -5155,8 +5607,8 @@ partial interface MLGraphBuilder { The resample2d(|input|, |options|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/rank=] is not 4, then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If [=MLGraphBuilder/checking resample options=] given |options| returns false, then [=exception/throw=] a {{TypeError}}. 1. Let |desc| be the result of [=MLGraphBuilder/calculating resample output sizes=] given |input| and |options|. If that returns failure, then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* @@ -5278,12 +5730,26 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + [=/any rank|N=] +
+ +
The sigmoid(|input|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the sigmoid operation. @@ -5382,12 +5848,26 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output N-D tensor that contains the softmax results, of the same shape as *input*. + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + [=/any rank|N=] +
+ +
The softmax(|input|, |axis|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |axis| is greater than or equal to |input|'s [=MLOperand/rank=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. @@ -5450,12 +5930,26 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + [=/any rank|N=] +
+ +
The softplus(|input|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the softplus operation. @@ -5511,12 +6005,26 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + [=/any rank|N=] +
+ +
The softsign(|input|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the softsign operation. @@ -5654,12 +6162,26 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} + [=/any rank|N=] +
+ +
The tanh(|input|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not {{MLOperandDataType/"float32"}} or {{MLOperandDataType/"float16"}}, then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the hyperbolic tangent operation. @@ -5861,11 +6383,33 @@ partial interface MLGraphBuilder { **Returns:** an {{MLOperand}}. The output tensor that contains the values selected element-wise from either the input or the other tensor. + + + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{condition}} + {{MLOperandDataType/"uint8"}} + [=/any rank|N=] +
{{input}} + [=/any data type|any=] + [=/any rank|N=] +
{{other}} + [=/same as=] {{input}} + [=/any rank|N=] +
+ +
The where(|condition|, |input|, |other|) method steps are: - 1. If |condition|'s [=MLOperand/dataType=] is not equal to {{MLOperandDataType/"uint8"}}, then [=exception/throw=] a {{TypeError}}. + 1. If |condition|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/dataType=] is not equal to |other|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. 1. Let |descriptor| be a new {{MLOperandDescriptor}}. 1. Set |descriptor|.{{MLOperandDescriptor/dataType}} to |input|'s [=MLOperand/dataType=]. From 6576e1601c32657e28c1e3f27e27fad4ac4af8b9 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Sat, 27 Apr 2024 21:54:18 -0700 Subject: [PATCH 02/20] fix broken link --- index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.bs b/index.bs index aacecaa3..74b4c22e 100644 --- a/index.bs +++ b/index.bs @@ -1992,7 +1992,7 @@ partial interface MLGraphBuilder { 1. If |inputChannels| % |options|.{{MLConv2dOptions/groups}} is not 0, then [=exception/throw=] a {{TypeError}}. 1. Else if |inputChannels| / |options|.{{MLConv2dOptions/groups}} is not equal to |filterInputChannels|, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConv2dOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=, then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=][0] is not equal to |outputChannels|, then [=exception/throw=] a {{TypeError}}. 1. Let |outputSizes| be the result of [=MLGraphBuilder/calculating conv2d output sizes=] given |inputHeight|, |inputWidth|, |filterHeight|, |filterWidth|, |options|.{{MLConv2dOptions/padding}}, |options|.{{MLConv2dOptions/strides}}, and |options|.{{MLConv2dOptions/dilations}}. From 5ae43b50c8691492a411afe35efc3d640786079c Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Mon, 29 Apr 2024 09:28:21 -0700 Subject: [PATCH 03/20] typo fix --- index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.bs b/index.bs index 8befbc85..2d2e3458 100644 --- a/index.bs +++ b/index.bs @@ -5186,7 +5186,7 @@ partial interface MLGraphBuilder { The prelu(|input|, |slope|) method steps are:
1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input| and |slope| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of any of |input| or |slop| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}., + 1. If the [=MLOperand/dataType=] of any of |input| or |slope| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}., 1. Let |descriptor| be a new {{MLOperandDescriptor}}. 1. Set |descriptor|.{{MLOperandDescriptor/dataType}} to |input|'s [=MLOperand/dataType=]. 1. Set |descriptor|.{{MLOperandDescriptor/dimensions}} to the result of [=unidirectionally broadcasting the shapes=] |slope|'s [=MLOperand/shape=] and |input|'s [=MLOperand/shape=]. From 295cd0b837da27f15780106049dba0ebcf44d4be Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Thu, 2 May 2024 12:16:21 -0700 Subject: [PATCH 04/20] Varioius fixes - gemm(): Fix ranks in table, align phrasing. - gru(): Align phrasing. - lstm(): Don't inline rank of 3, reference table. - matmul(): Align phrasing. - prelu(): Fix punctation. - triangular(): Add table, use for rank validation. - where(): Align phrasing. --- index.bs | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/index.bs b/index.bs index b4b2eef0..1db6c492 100644 --- a/index.bs +++ b/index.bs @@ -3056,11 +3056,11 @@ partial interface MLGraphBuilder { {{a}} {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - [=/any rank|N=] + 2 {{b}} [=/same as=] {{a}} - [=/any rank|N=] + 2 {{MLGemmOptions/c}} [=/same as=] {{a}} @@ -3073,9 +3073,8 @@ partial interface MLGraphBuilder { The gemm(|a|, |b|, |options|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |a| and |b| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |a|'s [=MLOperand/dataType=] is one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If |b|'s [=MLOperand/dataType=] is one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If |a|'s [=MLOperand/rank=] is not 2 or |b|'s [=MLOperand/rank=] is not 2, then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |a| or |b| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/rank=] of any of |a| or |b| is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. Let |shapeA| be a [=list/clone=] of |a|'s [=MLOperand/shape=]. 1. Let |shapeB| be a [=list/clone=] of |b|'s [=MLOperand/shape=]. 1. If |options|.{{MLGemmOptions/aTranspose}} is true, then reverse the order of the items in |shapeA|. @@ -3238,7 +3237,7 @@ partial interface MLGraphBuilder { 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |weight|, |recurrentWeight|, |options|.{{MLGruOptions/bias}} (if it [=map/exists=]), |options|.{{MLGruOptions/recurrentBias}} (if it [=map/exists=]), and |options|.{{MLGruOptions/initialHiddenState}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruOptions/activations}} [=map/exists=], and [=MLGraphBuilder/validating activation=] with [=this=] and any [=list/item=] in it returns false, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of either |input|, |weight| or |recurrentWeight| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |input|, |weight| or |recurrentWeight| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If the [=MLOperand/rank=] of any of |input|, |weight| or |recurrentWeight| is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/shape=][0] is not equal to |steps|, then [=exception/throw=] a {{TypeError}}. 1. Let |batchSize| be |input|'s [=MLOperand/shape=][1]. @@ -4347,7 +4346,7 @@ partial interface MLGraphBuilder { 1. If |options|.{{MLLstmOptions/activations}} [=map/exists=], and [=MLGraphBuilder/validating activation=] with [=this=] and any [=list/item=] in it returns false, then [=exception/throw=] a {{TypeError}}. 1. Let |numDirections| be 2 if |options|.{{MLLstmOptions/direction}} is {{MLRecurrentNetworkDirection/"both"}}, or 1 otherwise. 1. If the [=MLOperand/dataType=] of any of |input|, |weight| or |recurrentWeight| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/rank=] of any of |input|, |weight| or |recurrentWeight| is not 3, then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/rank=] of any of |input|, |weight| or |recurrentWeight| is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/shape=][0] is not equal to |steps|, then [=exception/throw=] a {{TypeError}}. 1. Let |batchSize| be |input|'s [=MLOperand/shape=][1]. 1. Let |inputSize| be |input|'s [=MLOperand/shape=][2]. @@ -4836,8 +4835,7 @@ partial interface MLGraphBuilder { The matmul(|a|, |b|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |a| and |b| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |a|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}., - 1. If |b|'s [=MLOperand/dataType=] is not equal to |a|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |a| or |b| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. Let |desc| be a new {{MLOperandDescriptor}}. 1. Set |desc|.{{MLOperandDescriptor/dimensions}} to the result of [=MLGraphBuilder/calculating matmul output sizes=] given |a| and |b|. 1. If that throws an error, re-[=exception/throw=] the error. @@ -5219,7 +5217,7 @@ partial interface MLGraphBuilder { The prelu(|input|, |slope|) method steps are: 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input| and |slope| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of any of |input| or |slope| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}., + 1. If the [=MLOperand/dataType=] of any of |input| or |slope| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. Let |descriptor| be a new {{MLOperandDescriptor}}. 1. Set |descriptor|.{{MLOperandDescriptor/dataType}} to |input|'s [=MLOperand/dataType=]. 1. Set |descriptor|.{{MLOperandDescriptor/dimensions}} to the result of [=unidirectionally broadcasting the shapes=] |slope|'s [=MLOperand/shape=] and |input|'s [=MLOperand/shape=]. @@ -6242,7 +6240,7 @@ partial interface MLGraphBuilder { 1. If |options|.{{MLTransposeOptions/permutation}} does not [=map/exist=], let |options|.{{MLTransposeOptions/permutation}} be the reversed sequence of all indices for |input|'s [=MLOperand/shape=]. 1. Otherwise if |options|.{{MLTransposeOptions/permutation}} [=map/exists=]: - 1. If its [=MLOperand/rank=] is not equal to |input|'s [=MLOperand/rank=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=list/size=] is not equal to |input|'s [=MLOperand/rank=], then [=exception/throw=] a {{TypeError}}. 1. If its values are not in [=the range=] 0 to |input|'s [=MLOperand/rank=] exclusive, then [=exception/throw=] a {{TypeError}}. 1. If it contains duplicate values, then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* @@ -6286,11 +6284,25 @@ partial interface MLGraphBuilder { **Returns:** an {{MLOperand}}. The output tensor representing a triangular matrix, or batch of matrices which is the same shape as the input. + + + + + +
input operand + [=/allowed data types=] + [=/allowed ranks=] +
{{input}} + [=/any data type|any=] + 2 or greater +
+ +
The triangular(|input|, |options|) method steps are: - 1. If |input|'s [=MLOperand/rank=] is less than 2, then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/rank=] is not one of its [=allowed ranks=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the triangular operation, given |options|. @@ -6408,8 +6420,7 @@ partial interface MLGraphBuilder { The where(|condition|, |input|, |other|) method steps are: - 1. If |condition|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not equal to |other|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |condition|, |input|, or |other| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. Let |descriptor| be a new {{MLOperandDescriptor}}. 1. Set |descriptor|.{{MLOperandDescriptor/dataType}} to |input|'s [=MLOperand/dataType=]. 1. Set |descriptor|.{{MLOperandDescriptor/dimensions}} to the result of [=bidirectionally broadcasting the shapes=] |input|'s [=MLOperand/shape=] and |other|'s [=MLOperand/shape=]. From 312e23ea3c5761e131abf3177706d6429a713614 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Tue, 7 May 2024 10:02:49 -0700 Subject: [PATCH 05/20] Remove redundant rank validation, when shape is validated --- index.bs | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/index.bs b/index.bs index 61341ba1..f6a504b3 100644 --- a/index.bs +++ b/index.bs @@ -1559,18 +1559,14 @@ partial interface MLGraphBuilder { 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLBatchNormalizationOptions/axis}} is not in [=the range=] 0 to |input|'s [=MLOperand/rank=], exclusive, then [=exception/throw=] a {{TypeError}}. 1. If |mean|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If |mean|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If |mean|'s [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}] », then [=exception/throw=] a {{TypeError}}. 1. If |variance|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If |variance|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If |variance|'s [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}] », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLBatchNormalizationOptions/scale}} [=map/exists=]: 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}] », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLBatchNormalizationOptions/bias}} [=map/exists=]: 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}] », then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |operator| be an [=operator=] for the batchNormalization operation, given |input|, |mean|, |variance| and |options|. @@ -1981,7 +1977,6 @@ partial interface MLGraphBuilder { 1. Otherwise, if |inputChannels| / |options|.{{MLConv2dOptions/groups}} is not equal to |filterInputChannels|, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConv2dOptions/bias}} [=map/exists=]: 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |outputChannels| », then [=exception/throw=] a {{TypeError}}. 1. Let |outputSizes| be the result of [=MLGraphBuilder/calculating conv2d output sizes=] given |inputHeight|, |inputWidth|, |filterHeight|, |filterWidth|, |options|.{{MLConv2dOptions/padding}}, |options|.{{MLConv2dOptions/strides}}, and |options|.{{MLConv2dOptions/dilations}}. 1. Switch on |options|.{{MLConv2dOptions/inputLayout}}: @@ -2212,7 +2207,6 @@ partial interface MLGraphBuilder { 1. Let |outputChannels| be |filterOutputChannels| * |options|.{{MLConvTranspose2dOptions/groups}} 1. If |options|.{{MLConvTranspose2dOptions/bias}} [=map/exists=]: 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |outputChannels| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConvTranspose2dOptions/outputSizes}} [=map/exists=], let |outputSizes| be |options|.{{MLConvTranspose2dOptions/outputSizes}}. 1. Otherwise, let |outputSizes| be the result of [=MLGraphBuilder/calculating convtranspose2d output sizes=] given |inputHeight|, |inputWidth|, |filterHeight|, |filterWidth|, |options|.{{MLConvTranspose2dOptions/padding}}, |options|.{{MLConvTranspose2dOptions/strides}}, |options|.{{MLConvTranspose2dOptions/dilations}}, and |options|.{{MLConvTranspose2dOptions/outputPadding}}. @@ -3230,15 +3224,12 @@ partial interface MLGraphBuilder {
1. If |options|.{{MLGruOptions/bias}} [=map/exists=]: 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, 3 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruOptions/recurrentBias}} [=map/exists=]: 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, 3 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruOptions/initialHiddenState}} [=map/exists=]: 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, |batchSize|, |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruOptions/activations}} [=map/exists=] and its [=list/size=] is not 2, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruOptions/activations}} [=map/exists=]: @@ -3829,11 +3820,9 @@ partial interface MLGraphBuilder { 1. Let |axis| be 1 if |options|.{{MLInstanceNormalizationOptions/layout}} is {{MLInputOperandLayout/"nchw"}}, and 3 otherwise. 1. If |options|.{{MLInstanceNormalizationOptions/scale}} [=map/exists=]: 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|axis|] », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLInstanceNormalizationOptions/bias}} [=map/exists=]: 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|axis|] », then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. @@ -4337,23 +4326,18 @@ partial interface MLGraphBuilder {
1. If |options|.{{MLLstmOptions/bias}} [=map/exists=]: 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, 4 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/recurrentBias}} [=map/exists=]: 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, 4 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/peepholeWeight}} [=map/exists=]: 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, 3 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/initialHiddenState}} [=map/exists=]: 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, |batchSize|, |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/initialCellState}} [=map/exists=]: 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, |batchSize|, |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/activations}} [=map/exists=]: 1. If its [=list/size=] is not 3, then [=exception/throw=] a {{TypeError}}. @@ -4598,15 +4582,12 @@ partial interface MLGraphBuilder {
1. If |options|.{{MLLstmCellOptions/bias}} [=map/exists=]: 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « 4 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmCellOptions/recurrentBias}} [=map/exists=]: 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « 4 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmCellOptions/peepholeWeight}} [=map/exists=]: 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « 3 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmCellOptions/activations}} [=map/exists=]: 1. If its [=list/size=] is not 3, then [=exception/throw=] a {{TypeError}}. From d298e216296c18e567eb0fa71b8a38a00901ff31 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Thu, 11 Jul 2024 09:57:36 -0700 Subject: [PATCH 06/20] Sync with updated where() param names --- index.bs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.bs b/index.bs index 90c42666..630cd801 100644 --- a/index.bs +++ b/index.bs @@ -6492,7 +6492,7 @@ partial interface MLGraphBuilder { **Returns:** an {{MLOperand}}. The output tensor that contains the values selected element-wise from either the trueValue or the falseValue tensor. - +
- -
input operand @@ -6504,12 +6504,12 @@ partial interface MLGraphBuilder { {{MLOperandDataType/"uint8"}} [=/any rank|N=]
{{input}} + {{trueValue}} [=/any data type|any=] [=/any rank|N=]
{{other}} - [=/same as=] {{input}} + {{falseValue}} + [=/same as=] {{trueValue}} [=/any rank|N=]
From 08f1cd11830947997a07276fad9a7d1bd9c0736b Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Wed, 17 Jul 2024 11:09:19 -0700 Subject: [PATCH 07/20] Fix link for linear() --- index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.bs b/index.bs index 9fc47b73..d9205531 100644 --- a/index.bs +++ b/index.bs @@ -4284,7 +4284,7 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. - +
+ + + +
input operand From 717ad62b8ff6014a17dee043c86d1cb5bd93b011 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Wed, 17 Jul 2024 11:15:26 -0700 Subject: [PATCH 08/20] Close tags for TR/TH/TD --- index.bs | 737 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 418 insertions(+), 319 deletions(-) diff --git a/index.bs b/index.bs index d9205531..eb57bf81 100644 --- a/index.bs +++ b/index.bs @@ -1599,30 +1599,36 @@ partial interface MLGraphBuilder { - + + + - + + + - + + + - + + + - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - [=/any rank|N=] + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}[=/any rank|N=]
{{mean}} - [=/same as=] {{input}} - 1 + {{mean}}[=/same as=] {{input}}1
{{variance}} - [=/same as=] {{input}} - 1 + {{variance}}[=/same as=] {{input}}1
{{MLBatchNormalizationOptions/scale}} - [=/same as=] {{input}} - 1 + {{MLBatchNormalizationOptions/scale}}[=/same as=] {{input}}1
{{MLBatchNormalizationOptions/bias}} - [=/same as=] {{input}} - 1 + {{MLBatchNormalizationOptions/bias}}[=/same as=] {{input}}1
@@ -1932,22 +1938,26 @@ partial interface MLGraphBuilder { - + + + - + + + - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - 4 + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}4
{{filter}} - [=/same as=] {{input}} - 4 + {{filter}}[=/same as=] {{input}}4
{{MLConv2dOptions/bias}} - {{input}} - 1 + {{MLConv2dOptions/bias}}{{input}}1
@@ -2170,22 +2180,26 @@ partial interface MLGraphBuilder { - + + + - + + + - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - 4 + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}4
{{filter}} - [=/same as=] {{input}} - 4 + {{filter}}[=/same as=] {{input}}4
{{MLConv2dOptions/bias}} - {{input}} - 1 + {{MLConv2dOptions/bias}}{{input}}1
@@ -2717,14 +2731,16 @@ partial interface MLGraphBuilder { - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - [=/any rank|N=] + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}[=/any rank|N=]
@@ -2856,18 +2872,21 @@ partial interface MLGraphBuilder { - + + + - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - [=/any data type|any=] - [=/any rank|N=] + {{input}}[=/any data type|any=][=/any rank|N=]
{{indices}} - {{MLOperandDataType/"int32"}}, {{MLOperandDataType/"uint32"}}, {{MLOperandDataType/"int64"}} - [=/any rank|N=] + {{indices}}{{MLOperandDataType/"int32"}}, {{MLOperandDataType/"uint32"}}, {{MLOperandDataType/"int64"}}[=/any rank|N=]
@@ -2990,14 +3009,16 @@ partial interface MLGraphBuilder { - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - [=/any rank|N=] + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}[=/any rank|N=]
@@ -3105,22 +3126,26 @@ partial interface MLGraphBuilder { - + + + - + + + - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{a}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - 2 + {{a}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}2
{{b}} - [=/same as=] {{a}} - 2 + {{b}}[=/same as=] {{a}}2
{{MLGemmOptions/c}} - [=/same as=] {{a}} - [=/any rank|N=] + {{MLGemmOptions/c}}[=/same as=] {{a}}[=/any rank|N=]
@@ -3267,34 +3292,41 @@ partial interface MLGraphBuilder { - + + + - + + + - + + + - + + + - + + + - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - 3 + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}3
{{weight}} - [=/same as=] {{input}} - 3 + {{weight}}[=/same as=] {{input}}3
{{recurrentWeight}} - [=/same as=] {{input}} - 3 + {{recurrentWeight}}[=/same as=] {{input}}3
{{MLGruOptions/bias}} - [=/same as=] {{input}} - 2 + {{MLGruOptions/bias}}[=/same as=] {{input}}2
{{MLGruOptions/recurrentBias}} - [=/same as=] {{input}} - 2 + {{MLGruOptions/recurrentBias}}[=/same as=] {{input}}2
{{MLGruOptions/initialHiddenState}} - [=/same as=] {{input}} - 3 + {{MLGruOptions/initialHiddenState}}[=/same as=] {{input}}3
@@ -3525,30 +3557,36 @@ partial interface MLGraphBuilder { - + + + - + + + - + + + - + + + - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - 2 + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}2
{{weight}} - [=/same as=] {{input}} - 2 + {{weight}}[=/same as=] {{input}}2
{{recurrentWeight}} - [=/same as=] {{input}} - 2 + {{recurrentWeight}}[=/same as=] {{input}}2
{{MLGruCellOptions/bias}} - [=/same as=] {{input}} - 1 + {{MLGruCellOptions/bias}}[=/same as=] {{input}}1
{{MLGruCellOptions/recurrentBias}} - [=/same as=] {{input}} - 1 + {{MLGruCellOptions/recurrentBias}}[=/same as=] {{input}}1
@@ -3735,14 +3773,16 @@ partial interface MLGraphBuilder { - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - [=/any rank|N=] + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}[=/any rank|N=]
@@ -3826,14 +3866,16 @@ partial interface MLGraphBuilder { - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - [=/any rank|N=] + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}[=/any rank|N=]
@@ -3941,22 +3983,26 @@ partial interface MLGraphBuilder { - + + + - + + + - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - 4 + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}4
{{MLInstanceNormalizationOptions/scale}} - {{input}} - 1 + {{MLInstanceNormalizationOptions/scale}}{{input}}1
{{MLInstanceNormalizationOptions/bias}} - {{input}} - 1 + {{MLInstanceNormalizationOptions/bias}}{{input}}1
@@ -4064,22 +4110,26 @@ partial interface MLGraphBuilder { - + + + - + + + - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - [=/any rank|N=] + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}[=/any rank|N=]
{{MLLayerNormalizationOptions/scale}} - {{input}} - [=/any rank|N=] + {{MLLayerNormalizationOptions/scale}}{{input}}[=/any rank|N=]
{{MLLayerNormalizationOptions/bias}} - {{input}} - [=/any rank|N=] + {{MLLayerNormalizationOptions/bias}}{{input}}[=/any rank|N=]
@@ -4183,14 +4233,16 @@ partial interface MLGraphBuilder { - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - [=/any rank|N=] + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}[=/any rank|N=]
@@ -4287,14 +4339,16 @@ partial interface MLGraphBuilder { - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - [=/any rank|N=] + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}[=/any rank|N=]
@@ -4437,42 +4491,51 @@ partial interface MLGraphBuilder { - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - 3 + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}3
{{weight}} - [=/same as=] {{input}} - 3 + {{weight}}[=/same as=] {{input}}3
{{recurrentWeight}} - [=/same as=] {{input}} - 3 + {{recurrentWeight}}[=/same as=] {{input}}3
{{MLLstmOptions/bias}} - [=/same as=] {{input}} - 2 + {{MLLstmOptions/bias}}[=/same as=] {{input}}2
{{MLLstmOptions/recurrentBias}} - [=/same as=] {{input}} - 2 + {{MLLstmOptions/recurrentBias}}[=/same as=] {{input}}2
{{MLLstmOptions/peepholeWeight}} - [=/same as=] {{input}} - 2 + {{MLLstmOptions/peepholeWeight}}[=/same as=] {{input}}2
{{MLLstmOptions/initialHiddenState}} - [=/same as=] {{input}} - 3 + {{MLLstmOptions/initialHiddenState}}[=/same as=] {{input}}3
{{MLLstmOptions/initialCellState}} - [=/same as=] {{input}} - 3 + {{MLLstmOptions/initialCellState}}[=/same as=] {{input}}3
@@ -4741,42 +4804,51 @@ partial interface MLGraphBuilder { - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - 2 + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}2
{{weight}} - [=/same as=] {{input}} - 2 + {{weight}}[=/same as=] {{input}}2
{{recurrentWeight}} - [=/same as=] {{input}} - 2 + {{recurrentWeight}}[=/same as=] {{input}}2
{{hiddenState}} - [=/same as=] {{input}} - 2 + {{hiddenState}}[=/same as=] {{input}}2
{{cellState}} - [=/same as=] {{input}} - 2 + {{cellState}}[=/same as=] {{input}}2
{{MLLstmCellOptions/bias}} - [=/same as=] {{input}} - 1 + {{MLLstmCellOptions/bias}}[=/same as=] {{input}}1
{{MLLstmCellOptions/recurrentBias}} - [=/same as=] {{input}} - 1 + {{MLLstmCellOptions/recurrentBias}}[=/same as=] {{input}}1
{{MLLstmCellOptions/peepholeWeight}} - [=/same as=] {{input}} - 1 + {{MLLstmCellOptions/peepholeWeight}}[=/same as=] {{input}}1
@@ -4982,18 +5054,21 @@ partial interface MLGraphBuilder { - + + + - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{a}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - 2 or greater + {{a}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}2 or greater
{{b}} - [=/same as=] {{a}} - 2 or greater + {{b}}[=/same as=] {{a}}2 or greater
@@ -5396,14 +5471,16 @@ partial interface MLGraphBuilder { - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}, {{MLOperandDataType/"int32"}}, {{MLOperandDataType/"int8"}} - [=/any rank|N=] + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}, {{MLOperandDataType/"int32"}}, {{MLOperandDataType/"int8"}}[=/any rank|N=]
@@ -5659,14 +5736,16 @@ partial interface MLGraphBuilder { - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}, {{MLOperandDataType/"int32"}}, {{MLOperandDataType/"int8"}} - [=/any rank|N=] + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}, {{MLOperandDataType/"int32"}}, {{MLOperandDataType/"int8"}}[=/any rank|N=]
@@ -5771,14 +5850,16 @@ partial interface MLGraphBuilder { - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - 4 + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}4
@@ -5889,14 +5970,16 @@ partial interface MLGraphBuilder { - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - [=/any rank|N=] + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}[=/any rank|N=]
@@ -6013,14 +6096,16 @@ partial interface MLGraphBuilder { - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - [=/any rank|N=] + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}[=/any rank|N=]
@@ -6085,14 +6170,16 @@ partial interface MLGraphBuilder { - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - [=/any rank|N=] + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}[=/any rank|N=]
@@ -6180,14 +6267,16 @@ partial interface MLGraphBuilder { - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - [=/any rank|N=] + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}[=/any rank|N=]
@@ -6336,14 +6425,16 @@ partial interface MLGraphBuilder { - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}} - [=/any rank|N=] + {{input}}{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}[=/any rank|N=]
@@ -6484,14 +6575,16 @@ partial interface MLGraphBuilder { - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{input}} - [=/any data type|any=] - 2 or greater + {{input}}[=/any data type|any=]2 or greater
@@ -6596,22 +6689,26 @@ partial interface MLGraphBuilder { - + + + - + + + - + + + - + + +
input operand - [=/allowed data types=] - [=/allowed ranks=] + input operand[=/allowed data types=][=/allowed ranks=]
{{condition}} - {{MLOperandDataType/"uint8"}} - [=/any rank|N=] + {{condition}}{{MLOperandDataType/"uint8"}}[=/any rank|N=]
{{trueValue}} - [=/any data type|any=] - [=/any rank|N=] + {{trueValue}}[=/any data type|any=][=/any rank|N=]
{{falseValue}} - [=/same as=] {{trueValue}} - [=/any rank|N=] + {{falseValue}}[=/same as=] {{trueValue}}[=/any rank|N=]
@@ -6968,35 +7065,37 @@ Operations present in other neural network inference APIs can often be emulated ## {{MLOperandDataType}} and {{ArrayBufferView}} compatibility ## {#appendices-mloperanddatatype-arraybufferview-compatibility} - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{MLOperandDataType}} - {{ArrayBufferView}} -
{{MLOperandDataType/float32}} - {{Float32Array}} -
{{MLOperandDataType/float16}} - {{Float16Array}} -
{{MLOperandDataType/int64}} - {{BigInt64Array}} -
{{MLOperandDataType/uint64}} - {{BigUint64Array}} -
{{MLOperandDataType/int32}} - {{Int32Array}} -
{{MLOperandDataType/uint32}} - {{Uint32Array}} -
{{MLOperandDataType/int8}} - {{Int8Array}} +
{{MLOperandDataType/uint8}} - {{Uint8Array}} + {{MLOperandDataType}}{{ArrayBufferView}}
{{MLOperandDataType/float32}}{{Float32Array}}
{{MLOperandDataType/float16}}{{Float16Array}}
{{MLOperandDataType/int64}}{{BigInt64Array}}
{{MLOperandDataType/uint64}}{{BigUint64Array}}
{{MLOperandDataType/int32}}{{Int32Array}}
{{MLOperandDataType/uint32}}{{Uint32Array}}
{{MLOperandDataType/int8}}{{Int8Array}}
{{MLOperandDataType/uint8}}{{Uint8Array}}

{{Float16Array}} is at ECMA Stage 3 signaling its design is finished. Implementers wanting to enable this type ahead native implementations can emulate the type by passing raw bits via {{Uint16Array}}. [Issue webnn#373]

From 235c141c5c9e63958277c4735801ef019354e4ad Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Tue, 30 Jul 2024 12:34:53 -0700 Subject: [PATCH 09/20] Missing prelu()'s slope arg --- index.bs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.bs b/index.bs index 6d1114a9..3dbd6eb3 100644 --- a/index.bs +++ b/index.bs @@ -5409,6 +5409,10 @@ partial interface MLGraphBuilder {
{{input}} {{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}, {{MLOperandDataType/"int32"}}, {{MLOperandDataType/"int8"}} [=/any rank|N=]
{{slope}}[=/same as=] {{input}}[=/any rank|N=]
From 450b2f6f4fe88eb076bfefb7662dd2476e147321 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Tue, 30 Jul 2024 13:19:24 -0700 Subject: [PATCH 10/20] fix links (yay lint) --- index.bs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/index.bs b/index.bs index 3dbd6eb3..290fea05 100644 --- a/index.bs +++ b/index.bs @@ -3046,7 +3046,7 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. - +
@@ -3858,7 +3858,7 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. -
input operand
+
@@ -4976,7 +4976,7 @@ partial interface MLGraphBuilder { - If either *a* or *b* is `N`-dimensional where `N > 2`, it is treated as a stack of matrices with dimensions corresponding to the last two indices. The matrix multiplication will be broadcast according to [[!numpy-broadcasting-rule]]. The shapes of *a* and *b*, except the last two dimensions, must be [=bidirectionally broadcastable=]. The output is a `N`-dimensional tensor whose rank is the maximum [=MLOperand/rank=] of the input tensors. For each dimension, except the last two, of the output tensor, its size is the maximum size along that dimension of the input tensors. -
input operand
+
@@ -5397,7 +5397,7 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. -
input operand
+
@@ -5669,7 +5669,7 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. -
input operand
+
@@ -5888,7 +5888,7 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. -
input operand
+
@@ -6001,7 +6001,7 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output N-D tensor that contains the softmax results, of the same shape as *input*. -
input operand
+
@@ -6074,7 +6074,7 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. -
input operand
+
@@ -6152,7 +6152,7 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. -
input operand
+
@@ -6291,7 +6291,7 @@ partial interface MLGraphBuilder { - an {{MLOperand}}. The output tensor of the same shape as *input*. -
input operand
+
@@ -6540,7 +6540,7 @@ partial interface MLGraphBuilder { **Returns:** an {{MLOperand}}. The output tensor that contains the values selected element-wise from either the trueValue or the falseValue tensor. -
input operand
+
From f4d404c743ff9e72775a9a835ceacc3ac97ca7f7 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Thu, 7 Nov 2024 13:52:52 -0800 Subject: [PATCH 11/20] Reorder steps to minimize diff --- index.bs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.bs b/index.bs index 4a8086fd..0cc2eace 100644 --- a/index.bs +++ b/index.bs @@ -2219,8 +2219,8 @@ partial dictionary MLOpSupportLimits { 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |filter|, and |options|.{{MLConv2dOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. - 1. If |filter|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |filter|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. + 1. If |filter|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConv2dOptions/padding}} does not [=map/exist=], set it to the [=/list=] « 0, 0, 0, 0 ». 1. Otherwise, if |options|.{{MLConv2dOptions/padding}}'s [=list/size=] is not 4, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConv2dOptions/strides}} does not [=map/exist=], set it to the [=/list=] « 1, 1 ». @@ -2278,8 +2278,8 @@ partial dictionary MLOpSupportLimits { 1. If |inputChannels| % |options|.{{MLConv2dOptions/groups}} is not 0, then [=exception/throw=] a {{TypeError}}. 1. Otherwise, if |inputChannels| / |options|.{{MLConv2dOptions/groups}} is not equal to |filterInputChannels|, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConv2dOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |outputChannels| », then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. Let |outputSizes| be the result of [=MLGraphBuilder/calculating conv2d output sizes=] given |inputHeight|, |inputWidth|, |filterHeight|, |filterWidth|, |options|.{{MLConv2dOptions/padding}}, |options|.{{MLConv2dOptions/strides}}, and |options|.{{MLConv2dOptions/dilations}}. 1. Switch on |options|.{{MLConv2dOptions/inputLayout}}:
@@ -2461,10 +2461,10 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |filter|, and |options|.{{MLConvTranspose2dOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. - 1. If |filter|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |filter|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. + 1. If |filter|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConvTranspose2dOptions/padding}} does not [=map/exist=], set it to the [=/list=] « 0, 0, 0, 0 ». 1. Otherwise, if |options|.{{MLConvTranspose2dOptions/padding}}'s [=list/size=] is not 4, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConvTranspose2dOptions/strides}} does not [=map/exist=], set it to the [=/list=] « 1, 1 ». @@ -2522,8 +2522,8 @@ partial dictionary MLOpSupportLimits { 1. If |inputChannels| is not equal to |filterInputChannels|, then [=exception/throw=] a {{TypeError}}. 1. Let |outputChannels| be |filterOutputChannels| * |options|.{{MLConvTranspose2dOptions/groups}}. 1. If |options|.{{MLConvTranspose2dOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |outputChannels| », then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConvTranspose2dOptions/outputSizes}} [=map/exists=], let |outputSizes| be |options|.{{MLConvTranspose2dOptions/outputSizes}}. 1. Otherwise, let |outputSizes| be the result of [=MLGraphBuilder/calculating convtranspose2d output sizes=] given |inputHeight|, |inputWidth|, |filterHeight|, |filterWidth|, |options|.{{MLConvTranspose2dOptions/padding}}, |options|.{{MLConvTranspose2dOptions/strides}}, |options|.{{MLConvTranspose2dOptions/dilations}}, and |options|.{{MLConvTranspose2dOptions/outputPadding}}. 1. Switch on |options|.{{MLConvTranspose2dOptions/inputLayout}}: From 1fee3982bec9165da79c53ff73fdba07150c4eb1 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Fri, 8 Nov 2024 10:40:41 -0800 Subject: [PATCH 12/20] Apply suggestions from code review "input" -> "same as input" Co-authored-by: Ningxin Hu --- index.bs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.bs b/index.bs index 0cc2eace..84d0723f 100644 --- a/index.bs +++ b/index.bs @@ -4442,12 +4442,12 @@ partial dictionary MLOpSupportLimits {
- + - +
input operand
{{MLInstanceNormalizationOptions/scale}}{{input}}[=/same as=] {{input}} 1
{{MLInstanceNormalizationOptions/bias}}{{input}}[=/same as=] {{input}} 1
@@ -4590,12 +4590,12 @@ partial dictionary MLOpSupportLimits { {{MLLayerNormalizationOptions/scale}} - {{input}} + [=/same as=] {{input}} [=/any rank|N=] {{MLLayerNormalizationOptions/bias}} - {{input}} + [=/same as=] {{input}} [=/any rank|N=] From 7960c2a0a84b5168a1abb5bd99d3bb78cd87b88d Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Mon, 11 Nov 2024 14:34:16 -0800 Subject: [PATCH 13/20] scope 'allowed' links --- index.bs | 130 +++++++++++++++++++++++++++---------------------------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/index.bs b/index.bs index 58e498a0..2d043df3 100644 --- a/index.bs +++ b/index.bs @@ -1730,18 +1730,18 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |mean|, |variance|, |options|.{{MLBatchNormalizationOptions/scale}} (if it [=map/exists=]), and |options|.{{MLBatchNormalizationOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLBatchNormalizationOptions/axis}} is not in [=the range=] 0 to |input|'s [=MLOperand/rank=], exclusive, then [=exception/throw=] a {{TypeError}}. - 1. If |mean|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |mean|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |mean|'s [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}] », then [=exception/throw=] a {{TypeError}}. - 1. If |variance|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |variance|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |variance|'s [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}] », then [=exception/throw=] a {{TypeError}}. 1. Set |options|.{{MLBatchNormalizationOptions/epsilon}} to the result of [=casting=] |options|.{{MLBatchNormalizationOptions/epsilon}} to |input|'s [=MLOperand/dataType=]. 1. If |options|.{{MLBatchNormalizationOptions/scale}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}] », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLBatchNormalizationOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}] », then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |operator| be an [=operator=] for the "batchNormalization" operation, given |input|, |mean|, |variance| and |options|. @@ -2220,10 +2220,10 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |filter|, and |options|.{{MLConv2dOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. - 1. If |filter|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. - 1. If |filter|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/rank=] is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. + 1. If |filter|'s [=MLOperand/rank=] is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. + 1. If |filter|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConv2dOptions/padding}} does not [=map/exist=], set it to the [=/list=] « 0, 0, 0, 0 ». 1. Otherwise, if |options|.{{MLConv2dOptions/padding}}'s [=list/size=] is not 4, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConv2dOptions/strides}} does not [=map/exist=], set it to the [=/list=] « 1, 1 ». @@ -2258,7 +2258,7 @@ partial dictionary MLOpSupportLimits { 1. Otherwise, if |inputChannels| / |options|.{{MLConv2dOptions/groups}} is not equal to |filterInputChannels|, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConv2dOptions/bias}} [=map/exists=]: 1. If its [=MLOperand/shape=] is not equal to « |outputChannels| », then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. Let |outputSizes| be the result of [=MLGraphBuilder/calculating conv2d output sizes=] given |inputHeight|, |inputWidth|, |filterHeight|, |filterWidth|, |options|.{{MLConv2dOptions/padding}}, |options|.{{MLConv2dOptions/strides}}, and |options|.{{MLConv2dOptions/dilations}}. 1. Switch on |options|.{{MLConv2dOptions/inputLayout}}:
@@ -2440,10 +2440,10 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |filter|, and |options|.{{MLConvTranspose2dOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If |filter|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. - 1. If |filter|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/rank=] is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |filter|'s [=MLOperand/rank=] is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. + 1. If |filter|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConvTranspose2dOptions/padding}} does not [=map/exist=], set it to the [=/list=] « 0, 0, 0, 0 ». 1. Otherwise, if |options|.{{MLConvTranspose2dOptions/padding}}'s [=list/size=] is not 4, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConvTranspose2dOptions/strides}} does not [=map/exist=], set it to the [=/list=] « 1, 1 ». @@ -2482,7 +2482,7 @@ partial dictionary MLOpSupportLimits { 1. Let |outputChannels| be |filterOutputChannels| * |options|.{{MLConvTranspose2dOptions/groups}}. 1. If |options|.{{MLConvTranspose2dOptions/bias}} [=map/exists=]: 1. If its [=MLOperand/shape=] is not equal to « |outputChannels| », then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConvTranspose2dOptions/outputSizes}} [=map/exists=], let |outputSizes| be |options|.{{MLConvTranspose2dOptions/outputSizes}}. 1. Otherwise, let |outputSizes| be the result of [=MLGraphBuilder/calculating convtranspose2d output sizes=] given |inputHeight|, |inputWidth|, |filterHeight|, |filterWidth|, |options|.{{MLConvTranspose2dOptions/padding}}, |options|.{{MLConvTranspose2dOptions/strides}}, |options|.{{MLConvTranspose2dOptions/dilations}}, and |options|.{{MLConvTranspose2dOptions/outputPadding}}. 1. Switch on |options|.{{MLConvTranspose2dOptions/inputLayout}}: @@ -3066,7 +3066,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. Set |options|.{{MLEluOptions/alpha}} to the result of [=casting=] |options|.{{MLEluOptions/alpha}} to |input|'s [=MLOperand/dataType=]. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. @@ -3229,7 +3229,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input| and |indices| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |indices|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |indices|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. Let |shapeInput| be |input|'s [=MLOperand/shape=] and |rankInput| be |shapeInput|'s [=MLOperand/rank=]. 1. Let |shapeIndices| be |indices|'s [=MLOperand/shape=]. 1. Let |axis| be |options|.{{MLGatherOptions/axis}}. @@ -3367,7 +3367,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the "gelu" operation given |options|. @@ -3504,8 +3504,8 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |a| and |b| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of any of |a| or |b| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/rank=] of any of |a| or |b| is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |a| or |b| is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/rank=] of any of |a| or |b| is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. Set |options|.{{MLGemmOptions/alpha}} to the result of [=casting=] |options|.{{MLGemmOptions/alpha}} to |a|'s [=MLOperand/dataType=]. 1. Set |options|.{{MLGemmOptions/beta}} to the result of [=casting=] |options|.{{MLGemmOptions/beta}} to |a|'s [=MLOperand/dataType=]. 1. Let |shapeA| be a [=list/clone=] of |a|'s [=MLOperand/shape=]. @@ -3515,7 +3515,7 @@ partial dictionary MLOpSupportLimits { 1. If |shapeA|[1] is not equal to |shapeB|[0], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGemmOptions/c}} [=map/exists=]: 1. If it is not [=unidirectionally broadcastable=] to the shape « |shapeA|[0], |shapeB|[1] », then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. Let |desc| be the result of [=creating an MLOperandDescriptor=] given |a|'s [=MLOperand/dataType=] and « |shapeA|[0], |shapeB|[1] ». 1. *Make graph connections:* 1. Let |output| be the result of [=creating an MLOperand=] given [=this=] and |desc|. @@ -3726,8 +3726,8 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |weight|, |recurrentWeight|, |options|.{{MLGruOptions/bias}} (if it [=map/exists=]), |options|.{{MLGruOptions/recurrentBias}} (if it [=map/exists=]), and |options|.{{MLGruOptions/initialHiddenState}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of any of |input|, |weight| or |recurrentWeight| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/rank=] of any of |input|, |weight| or |recurrentWeight| is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |input|, |weight| or |recurrentWeight| is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/rank=] of any of |input|, |weight| or |recurrentWeight| is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/shape=][0] is not equal to |steps|, then [=exception/throw=] a {{TypeError}}. 1. Let |batchSize| be |input|'s [=MLOperand/shape=][1]. 1. Let |inputSize| be |input|'s [=MLOperand/shape=][2]. @@ -3740,13 +3740,13 @@ partial dictionary MLOpSupportLimits { Some underlying platforms operate on a single bias tensor which is a concatenation of {{MLGruOptions/bias}} and {{MLGruOptions/recurrentBias}}. Therefore, 3 * |hiddenSize| + 3 * |hiddenSize| must also be a [=valid dimension=].
1. If |options|.{{MLGruOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, 3 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruOptions/recurrentBias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, 3 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruOptions/initialHiddenState}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, |batchSize|, |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruOptions/activations}} [=map/exists=]: 1. If its [=list/size=] is not 2, then [=exception/throw=] a {{TypeError}}. @@ -4017,8 +4017,8 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |weight|, |recurrentWeight|, |hiddenState|, |options|.{{MLGruCellOptions/bias}} (if it [=map/exists=]), and |options|.{{MLGruCellOptions/recurrentBias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of any of |input|, |weight|, |recurrentWeight|, or |hiddenState| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/rank=] of any of |input|, |weight|, |recurrentWeight| or |hiddenState| is not its [=allowed ranks=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |input|, |weight|, |recurrentWeight|, or |hiddenState| is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/rank=] of any of |input|, |weight|, |recurrentWeight| or |hiddenState| is not its [=/allowed ranks=], then [=exception/throw=] a {{TypeError}}. 1. Let |batchSize| be |input|'s [=MLOperand/shape=][0]. 1. Let |inputSize| be |input|'s [=MLOperand/shape=][1]. 1. If |weight|'s [=MLOperand/shape=] is not equal to « 3 * |hiddenSize|, |inputSize| », then [=exception/throw=] a {{TypeError}}. @@ -4030,10 +4030,10 @@ partial dictionary MLOpSupportLimits { Some underlying platforms operate on a single bias tensor which is a concatenation of {{MLGruCellOptions/bias}} and {{MLGruCellOptions/recurrentBias}}. Therefore, 3 * |hiddenSize| + 3 * |hiddenSize| must also be a [=valid dimension=].
1. If |options|.{{MLGruCellOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « 3 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruCellOptions/recurrentBias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « 3 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruCellOptions/activations}} [=map/exists=]: 1. If its [=list/size=] is not 2, then [=exception/throw=] a {{TypeError}}. @@ -4220,7 +4220,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. Set |options|.{{MLHardSigmoidOptions/alpha}} to the result of [=casting=] |options|.{{MLHardSigmoidOptions/alpha}} to |input|'s [=MLOperand/dataType=]. 1. Set |options|.{{MLHardSigmoidOptions/beta}} to the result of [=casting=] |options|.{{MLHardSigmoidOptions/beta}} to |input|'s [=MLOperand/dataType=]. 1. *Make graph connections:* @@ -4299,7 +4299,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the "hardSwish" operation, given |options|. @@ -4435,15 +4435,15 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |options|.{{MLInstanceNormalizationOptions/scale}} (if it [=map/exists=]), and |options|.{{MLInstanceNormalizationOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/rank=] is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. Set |options|.{{MLInstanceNormalizationOptions/epsilon}} to the result of [=casting=] |options|.{{MLInstanceNormalizationOptions/epsilon}} to |input|'s [=MLOperand/dataType=]. 1. Let |axis| be 1 if |options|.{{MLInstanceNormalizationOptions/layout}} is {{MLInputOperandLayout/"nchw"}}, and 3 otherwise. 1. If |options|.{{MLInstanceNormalizationOptions/scale}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|axis|] », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLInstanceNormalizationOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|axis|] », then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. @@ -4571,15 +4571,15 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |options|.{{MLLayerNormalizationOptions/scale}} (if it [=map/exists=]), and |options|.{{MLLayerNormalizationOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLayerNormalizationOptions/axes}} does not [=map/exist=], then set |options|.{{MLLayerNormalizationOptions/axes}} to a new [=/list=], either equal to [=the range=] from 1 to |input|'s [=MLOperand/rank=], exclusive, if |input|'s [=MLOperand/rank=] is greater than 1, or an empty [=/list=] otherwise. 1. Otherwise, if |options|.{{MLLayerNormalizationOptions/axes}} contains duplicate values, or if any of its elements is not in [=the range=] 0 to |input|'s [=MLOperand/rank=], exclusive, then return failure. 1. Set |options|.{{MLLayerNormalizationOptions/epsilon}} to the result of [=casting=] |options|.{{MLLayerNormalizationOptions/epsilon}} to |input|'s [=MLOperand/dataType=]. 1. If |options|.{{MLLayerNormalizationOptions/scale}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/rank=] is not equal to |options|.{{MLLayerNormalizationOptions/axes}}'s [=list/size=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLayerNormalizationOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/rank=] is not equal to |options|.{{MLLayerNormalizationOptions/axes}}'s [=list/size=], then [=exception/throw=] a {{TypeError}}. 1. [=list/For each=] |index| in [=the range=] 0 to |options|.{{MLLayerNormalizationOptions/axes}}'s [=list/size=], exclusive: 1. Let |axis| be |options|.{{MLLayerNormalizationOptions/axes}}[|index|]. @@ -4691,7 +4691,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. Set |options|.{{MLLeakyReluOptions/alpha}} to the result of [=casting=] |options|.{{MLLeakyReluOptions/alpha}} to |input|'s [=MLOperand/dataType=]. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. @@ -4783,7 +4783,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. Set |options|.{{MLLinearOptions/alpha}} to the result of [=casting=] |options|.{{MLLinearOptions/alpha}} to |input|'s [=MLOperand/dataType=]. 1. Set |options|.{{MLLinearOptions/beta}} to the result of [=casting=] |options|.{{MLLinearOptions/beta}} to |input|'s [=MLOperand/dataType=]. 1. *Make graph connections:* @@ -4994,8 +4994,8 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |weight|, |recurrentWeight|, |options|.{{MLLstmOptions/bias}} (if it [=map/exists=]), |options|.{{MLLstmOptions/recurrentBias}} (if it [=map/exists=]), |options|.{{MLLstmOptions/peepholeWeight}} (if it [=map/exists=]), |options|.{{MLLstmOptions/initialHiddenState}} (if it [=map/exists=]), and |options|.{{MLLstmOptions/initialCellState}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. 1. Let |numDirections| be 2 if |options|.{{MLLstmOptions/direction}} is {{MLRecurrentNetworkDirection/"both"}}, or 1 otherwise. - 1. If the [=MLOperand/dataType=] of any of |input|, |weight| or |recurrentWeight| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/rank=] of any of |input|, |weight| or |recurrentWeight| is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |input|, |weight| or |recurrentWeight| is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/rank=] of any of |input|, |weight| or |recurrentWeight| is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/shape=][0] is not equal to |steps|, then [=exception/throw=] a {{TypeError}}. 1. Let |batchSize| be |input|'s [=MLOperand/shape=][1]. 1. Let |inputSize| be |input|'s [=MLOperand/shape=][2]. @@ -5007,19 +5007,19 @@ partial dictionary MLOpSupportLimits { Some underlying platforms operate on a single bias tensor which is a concatenation of {{MLLstmOptions/bias}} and {{MLLstmOptions/recurrentBias}}. Therefore, 4 * |hiddenSize| + 4 * |hiddenSize| must also be a [=valid dimension=].
1. If |options|.{{MLLstmOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, 4 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/recurrentBias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, 4 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/peepholeWeight}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, 3 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/initialHiddenState}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, |batchSize|, |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/initialCellState}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, |batchSize|, |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/activations}} [=map/exists=]: 1. If its [=list/size=] is not 3, then [=exception/throw=] a {{TypeError}}. @@ -5343,8 +5343,8 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |weight|, |recurrentWeight|, |hiddenState|, |cellState|, |options|.{{MLLstmCellOptions/bias}} (if it [=map/exists=]), |options|.{{MLLstmCellOptions/recurrentBias}} (if it [=map/exists=]), and |options|.{{MLLstmCellOptions/peepholeWeight}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of any of |input|, |weight|, |recurrentWeight|, |hiddenState| or |cellState| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/rank=] of any of |input|, |weight|, |recurrentWeight|, |hiddenState| or |cellState| is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |input|, |weight|, |recurrentWeight|, |hiddenState| or |cellState| is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/rank=] of any of |input|, |weight|, |recurrentWeight|, |hiddenState| or |cellState| is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. Let |batchSize| be |input|'s [=MLOperand/shape=][0]. 1. Let |inputSize| be |input|'s [=MLOperand/shape=][1]. 1. If |weight|'s [=MLOperand/shape=] is not equal to « 4 * |hiddenSize|, |inputSize| », then [=exception/throw=] a {{TypeError}}. @@ -5357,13 +5357,13 @@ partial dictionary MLOpSupportLimits { Some underlying platforms operate on a single bias tensor which is a concatenation of {{MLLstmCellOptions/bias}} and {{MLLstmCellOptions/recurrentBias}}. Therefore, 4 * |hiddenSize| + 4 * |hiddenSize| must also be a [=valid dimension=].
1. If |options|.{{MLLstmCellOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « 4 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmCellOptions/recurrentBias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « 4 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmCellOptions/peepholeWeight}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « 3 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmCellOptions/activations}} [=map/exists=]: 1. If its [=list/size=] is not 3, then [=exception/throw=] a {{TypeError}}. @@ -5595,7 +5595,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |a| and |b| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of any of |a| or |b| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |a| or |b| is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. Let |outputShape| be the result of [=MLGraphBuilder/calculating matmul output sizes=] given |a| and |b|. 1. If that throws an error, re-[=exception/throw=] the error. 1. Let |desc| be the result of [=creating an MLOperandDescriptor=] given |a|'s [=MLOperand/dataType=] and |outputShape|. @@ -6034,7 +6034,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input| and |slope| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of any of |input| or |slope| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |input| or |slope| is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. Let |outputShape| be to the result of [=bidirectionally broadcasting=] |slope|'s [=MLOperand/shape=] and |input|'s [=MLOperand/shape=]. 1. If that returns failure, then [=exception/throw=] a {{TypeError}}. 1. Let |descriptor| be the result of [=creating an MLOperandDescriptor=] given |input|'s [=MLOperand/dataType=] and |outputShape|. @@ -6348,7 +6348,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the "relu" operation, given |options|. @@ -6479,8 +6479,8 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/rank=] is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/rank=] is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If [=MLGraphBuilder/checking resample options=] given |options| and |input| returns false, then [=exception/throw=] a {{TypeError}}. 1. Let |desc| be the result of [=MLGraphBuilder/calculating resample output sizes=] given |input| and |options|. If that returns failure, then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* @@ -6595,7 +6595,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the "sigmoid" operation, given |options|. @@ -6727,7 +6727,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. If |axis| is greater than or equal to |input|'s [=MLOperand/rank=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. @@ -6809,7 +6809,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the "softplus" operation and |options|. @@ -6896,7 +6896,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the "softsign" operation and |options|. @@ -7068,7 +7068,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the "tanh" operation, given |options|. @@ -7219,7 +7219,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/rank=] is not one of its [=allowed ranks=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/rank=] is not one of its [=/allowed ranks=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the "triangular" operation, given |options|. @@ -7375,7 +7375,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |condition|, |trueValue|, and |falseValue| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of any of |condition|, |trueValue|, or |falseValue| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |condition|, |trueValue|, or |falseValue| is not one of its [=/allowed data types=], 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]. From 8d9b3a575422eb16c3d1857242c3fe46544e9a86 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Mon, 11 Nov 2024 14:53:05 -0800 Subject: [PATCH 14/20] add table captions; link steps to tables --- index.bs | 196 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 112 insertions(+), 84 deletions(-) diff --git a/index.bs b/index.bs index 2d043df3..5df617ae 100644 --- a/index.bs +++ b/index.bs @@ -915,7 +915,7 @@ When the {{MLContext/[[contextType]]}} is set to [=context type/default=] with t To validate buffer with descriptor given {{ArrayBufferView}} |bufferView| and {{MLOperandDescriptor}} |descriptor|, run the following steps: - 1. If |bufferView|'s [=element type=] does not match to |descriptor|.{{MLOperandDescriptor/dataType}} according to [this table](#appendices-mloperanddatatype-arraybufferview-compatibility), return false. + 1. If |bufferView|'s [=element type=] does not match to |descriptor|.{{MLOperandDescriptor/dataType}} according to [this table](#appendices-mloperanddatatype-arraybufferview-compatibility), return false. 1. If |bufferView|.\[[ByteLength]] is not equal to |descriptor|'s [=MLOperandDescriptor/byte length=], return false.
@@ -1667,7 +1667,8 @@ partial dictionary MLOpSupportLimits { **Returns:** an {{MLOperand}}. The batch-normalized N-D tensor of the same shape as *input*. - +
+ @@ -1730,18 +1731,18 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |mean|, |variance|, |options|.{{MLBatchNormalizationOptions/scale}} (if it [=map/exists=]), and |options|.{{MLBatchNormalizationOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-batchNormalization)), then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLBatchNormalizationOptions/axis}} is not in [=the range=] 0 to |input|'s [=MLOperand/rank=], exclusive, then [=exception/throw=] a {{TypeError}}. - 1. If |mean|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |mean|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-batchNormalization)), then [=exception/throw=] a {{TypeError}}. 1. If |mean|'s [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}] », then [=exception/throw=] a {{TypeError}}. - 1. If |variance|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |variance|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-batchNormalization)), then [=exception/throw=] a {{TypeError}}. 1. If |variance|'s [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}] », then [=exception/throw=] a {{TypeError}}. 1. Set |options|.{{MLBatchNormalizationOptions/epsilon}} to the result of [=casting=] |options|.{{MLBatchNormalizationOptions/epsilon}} to |input|'s [=MLOperand/dataType=]. 1. If |options|.{{MLBatchNormalizationOptions/scale}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-batchNormalization)), then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}] », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLBatchNormalizationOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-batchNormalization)), then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|options|.{{MLBatchNormalizationOptions/axis}}] », then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |operator| be an [=operator=] for the "batchNormalization" operation, given |input|, |mean|, |variance| and |options|. @@ -2148,7 +2149,8 @@ partial dictionary MLOpSupportLimits { `outputSize = 1 + (inputSize - (filterSize - 1) * dilation - 1 + beginningPadding + endingPadding) / stride` -
Constraints for {{MLGraphBuilder/batchNormalization()}}
input operand
+
+ @@ -2220,10 +2222,10 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |filter|, and |options|.{{MLConv2dOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-conv2d)), then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/rank=] is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If |filter|'s [=MLOperand/rank=] is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. - 1. If |filter|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |filter|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-conv2d)), then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConv2dOptions/padding}} does not [=map/exist=], set it to the [=/list=] « 0, 0, 0, 0 ». 1. Otherwise, if |options|.{{MLConv2dOptions/padding}}'s [=list/size=] is not 4, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConv2dOptions/strides}} does not [=map/exist=], set it to the [=/list=] « 1, 1 ». @@ -2258,7 +2260,7 @@ partial dictionary MLOpSupportLimits { 1. Otherwise, if |inputChannels| / |options|.{{MLConv2dOptions/groups}} is not equal to |filterInputChannels|, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConv2dOptions/bias}} [=map/exists=]: 1. If its [=MLOperand/shape=] is not equal to « |outputChannels| », then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-conv2d)), then [=exception/throw=] a {{TypeError}}. 1. Let |outputSizes| be the result of [=MLGraphBuilder/calculating conv2d output sizes=] given |inputHeight|, |inputWidth|, |filterHeight|, |filterWidth|, |options|.{{MLConv2dOptions/padding}}, |options|.{{MLConv2dOptions/strides}}, and |options|.{{MLConv2dOptions/dilations}}. 1. Switch on |options|.{{MLConv2dOptions/inputLayout}}:
@@ -2385,7 +2387,8 @@ partial dictionary MLOpSupportLimits { `outputSize = (inputSize - 1) * stride + (filterSize - 1) * dilation + 1 - beginningPadding - endingPadding + outputPadding` -
Constraints for {{MLGraphBuilder/conv2d()}}
input operand
+
+ @@ -2441,9 +2444,9 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |filter|, and |options|.{{MLConvTranspose2dOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/rank=] is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-convTranspose2d)), then [=exception/throw=] a {{TypeError}}. 1. If |filter|'s [=MLOperand/rank=] is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. - 1. If |filter|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |filter|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-convTranspose2d)), then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConvTranspose2dOptions/padding}} does not [=map/exist=], set it to the [=/list=] « 0, 0, 0, 0 ». 1. Otherwise, if |options|.{{MLConvTranspose2dOptions/padding}}'s [=list/size=] is not 4, then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConvTranspose2dOptions/strides}} does not [=map/exist=], set it to the [=/list=] « 1, 1 ». @@ -2482,7 +2485,7 @@ partial dictionary MLOpSupportLimits { 1. Let |outputChannels| be |filterOutputChannels| * |options|.{{MLConvTranspose2dOptions/groups}}. 1. If |options|.{{MLConvTranspose2dOptions/bias}} [=map/exists=]: 1. If its [=MLOperand/shape=] is not equal to « |outputChannels| », then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-convTranspose2d)), then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLConvTranspose2dOptions/outputSizes}} [=map/exists=], let |outputSizes| be |options|.{{MLConvTranspose2dOptions/outputSizes}}. 1. Otherwise, let |outputSizes| be the result of [=MLGraphBuilder/calculating convtranspose2d output sizes=] given |inputHeight|, |inputWidth|, |filterHeight|, |filterWidth|, |options|.{{MLConvTranspose2dOptions/padding}}, |options|.{{MLConvTranspose2dOptions/strides}}, |options|.{{MLConvTranspose2dOptions/dilations}}, and |options|.{{MLConvTranspose2dOptions/outputPadding}}. 1. Switch on |options|.{{MLConvTranspose2dOptions/inputLayout}}: @@ -3039,7 +3042,8 @@ partial dictionary MLOpSupportLimits { - an {{MLOperand}}. The output tensor of the same shape as *input*. -
Constraints for {{MLGraphBuilder/convTranspose2d()}}
input operand
+
+ @@ -3066,7 +3070,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-elu)), then [=exception/throw=] a {{TypeError}}. 1. Set |options|.{{MLEluOptions/alpha}} to the result of [=casting=] |options|.{{MLEluOptions/alpha}} to |input|'s [=MLOperand/dataType=]. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. @@ -3202,7 +3206,8 @@ partial dictionary MLOpSupportLimits { The {{MLGraphBuilder/gather(input, indices, options)/indices}} parameter to {{MLGraphBuilder/gather()}} can not be clamped to the allowed range when the graph is built because the inputs are not known until execution. Implementations can introduce {{MLGraphBuilder/clamp()}} in the compiled graph if the required clamping behavior is not provided by the underlying platform. Similarly, if the underlying platform does not support negative indices, the implementation can introduce operations in the compiled graph to transform a negative index from the end of the dimension into a positive index. -
Constraints for {{MLGraphBuilder/elu()}}
input operand
+
+ @@ -3229,7 +3234,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input| and |indices| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |indices|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |indices|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-gather)), then [=exception/throw=] a {{TypeError}}. 1. Let |shapeInput| be |input|'s [=MLOperand/shape=] and |rankInput| be |shapeInput|'s [=MLOperand/rank=]. 1. Let |shapeIndices| be |indices|'s [=MLOperand/shape=]. 1. Let |axis| be |options|.{{MLGatherOptions/axis}}. @@ -3340,7 +3345,8 @@ partial dictionary MLOpSupportLimits { - an {{MLOperand}}. The output tensor of the same shape as *input*. -
Constraints for {{MLGraphBuilder/gather()}}
input operand
+
+ @@ -3367,7 +3373,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-gelu)), then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the "gelu" operation given |options|. @@ -3455,7 +3461,8 @@ partial dictionary MLOpSupportLimits { **Returns:** an {{MLOperand}}. The output 2-D tensor of shape *[M, N]* that contains the calculated product of all the inputs. -
Constraints for {{MLGraphBuilder/gelu()}}
input operand
+
+ @@ -3504,7 +3511,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |a| and |b| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of any of |a| or |b| is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |a| or |b| is not one of its [=/allowed data types=] (according to [this table](#constraints-gemm)), then [=exception/throw=] a {{TypeError}}. 1. If the [=MLOperand/rank=] of any of |a| or |b| is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. Set |options|.{{MLGemmOptions/alpha}} to the result of [=casting=] |options|.{{MLGemmOptions/alpha}} to |a|'s [=MLOperand/dataType=]. 1. Set |options|.{{MLGemmOptions/beta}} to the result of [=casting=] |options|.{{MLGemmOptions/beta}} to |a|'s [=MLOperand/dataType=]. @@ -3515,7 +3522,7 @@ partial dictionary MLOpSupportLimits { 1. If |shapeA|[1] is not equal to |shapeB|[0], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGemmOptions/c}} [=map/exists=]: 1. If it is not [=unidirectionally broadcastable=] to the shape « |shapeA|[0], |shapeB|[1] », then [=exception/throw=] a {{TypeError}}. - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-gemm)), then [=exception/throw=] a {{TypeError}}. 1. Let |desc| be the result of [=creating an MLOperandDescriptor=] given |a|'s [=MLOperand/dataType=] and « |shapeA|[0], |shapeB|[1] ». 1. *Make graph connections:* 1. Let |output| be the result of [=creating an MLOperand=] given [=this=] and |desc|. @@ -3656,7 +3663,8 @@ partial dictionary MLOpSupportLimits { **Returns:** [=sequence=]<{{MLOperand}}>. The first element is a 3-D tensor of shape *[numDirections, batchSize, hiddenSize]*, the cell output from the last time step of the network. Additionally, if |options|.{{MLGruOptions/returnSequence}} is set to true, the second element is the 4-D output tensor of shape *[steps, numDirections, batchSize, hiddenSize]* containing every cell outputs from each time step in the temporal sequence. -
Constraints for {{MLGraphBuilder/gemm()}}
input operand
+
+ @@ -3726,7 +3734,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |weight|, |recurrentWeight|, |options|.{{MLGruOptions/bias}} (if it [=map/exists=]), |options|.{{MLGruOptions/recurrentBias}} (if it [=map/exists=]), and |options|.{{MLGruOptions/initialHiddenState}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of any of |input|, |weight| or |recurrentWeight| is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |input|, |weight| or |recurrentWeight| is not one of its [=/allowed data types=] (according to [this table](#constraints-gru)), then [=exception/throw=] a {{TypeError}}. 1. If the [=MLOperand/rank=] of any of |input|, |weight| or |recurrentWeight| is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/shape=][0] is not equal to |steps|, then [=exception/throw=] a {{TypeError}}. 1. Let |batchSize| be |input|'s [=MLOperand/shape=][1]. @@ -3740,13 +3748,13 @@ partial dictionary MLOpSupportLimits { Some underlying platforms operate on a single bias tensor which is a concatenation of {{MLGruOptions/bias}} and {{MLGruOptions/recurrentBias}}. Therefore, 3 * |hiddenSize| + 3 * |hiddenSize| must also be a [=valid dimension=]. 1. If |options|.{{MLGruOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-gru)), then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, 3 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruOptions/recurrentBias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-gru)), then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, 3 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruOptions/initialHiddenState}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-gru)), then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, |batchSize|, |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruOptions/activations}} [=map/exists=]: 1. If its [=list/size=] is not 2, then [=exception/throw=] a {{TypeError}}. @@ -3952,7 +3960,8 @@ partial dictionary MLOpSupportLimits { **Returns:** an {{MLOperand}}. The 2-D tensor of shape *[batchSize, hiddenSize]*, the cell output hidden state of a single time step of the recurrent network. -
Constraints for {{MLGraphBuilder/gru()}}
input operand
+
+ @@ -4017,8 +4026,8 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |weight|, |recurrentWeight|, |hiddenState|, |options|.{{MLGruCellOptions/bias}} (if it [=map/exists=]), and |options|.{{MLGruCellOptions/recurrentBias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of any of |input|, |weight|, |recurrentWeight|, or |hiddenState| is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/rank=] of any of |input|, |weight|, |recurrentWeight| or |hiddenState| is not its [=/allowed ranks=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |input|, |weight|, |recurrentWeight|, or |hiddenState| is not one of its [=/allowed data types=] (according to [this table](#constraints-gruCell)), then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/rank=] of any of |input|, |weight|, |recurrentWeight| or |hiddenState| is not its [=/allowed ranks=] (according to [this table](#constraints-gruCell)), then [=exception/throw=] a {{TypeError}}. 1. Let |batchSize| be |input|'s [=MLOperand/shape=][0]. 1. Let |inputSize| be |input|'s [=MLOperand/shape=][1]. 1. If |weight|'s [=MLOperand/shape=] is not equal to « 3 * |hiddenSize|, |inputSize| », then [=exception/throw=] a {{TypeError}}. @@ -4030,10 +4039,10 @@ partial dictionary MLOpSupportLimits { Some underlying platforms operate on a single bias tensor which is a concatenation of {{MLGruCellOptions/bias}} and {{MLGruCellOptions/recurrentBias}}. Therefore, 3 * |hiddenSize| + 3 * |hiddenSize| must also be a [=valid dimension=]. 1. If |options|.{{MLGruCellOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-gruCell)), then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « 3 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruCellOptions/recurrentBias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-gruCell)), then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « 3 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLGruCellOptions/activations}} [=map/exists=]: 1. If its [=list/size=] is not 2, then [=exception/throw=] a {{TypeError}}. @@ -4193,7 +4202,8 @@ partial dictionary MLOpSupportLimits { - an {{MLOperand}}. The output tensor of the same shape as *input*. -
Constraints for {{MLGraphBuilder/gruCell()}}
input operand
+
+ @@ -4220,7 +4230,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-hardSigmoid)), then [=exception/throw=] a {{TypeError}}. 1. Set |options|.{{MLHardSigmoidOptions/alpha}} to the result of [=casting=] |options|.{{MLHardSigmoidOptions/alpha}} to |input|'s [=MLOperand/dataType=]. 1. Set |options|.{{MLHardSigmoidOptions/beta}} to the result of [=casting=] |options|.{{MLHardSigmoidOptions/beta}} to |input|'s [=MLOperand/dataType=]. 1. *Make graph connections:* @@ -4272,7 +4282,8 @@ partial dictionary MLOpSupportLimits { - an {{MLOperand}}. The output tensor of the same shape as *input*. -
Constraints for {{MLGraphBuilder/hardSigmoid()}}
input operand
+
+ @@ -4299,7 +4310,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-hardSwish)), then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the "hardSwish" operation, given |options|. @@ -4386,7 +4397,8 @@ partial dictionary MLOpSupportLimits { **Returns:** an {{MLOperand}}. The instance-normalized 4-D tensor of the same shape as *input*. -
Constraints for {{MLGraphBuilder/hardSwish()}}
input operand
+
+ @@ -4435,15 +4447,15 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |options|.{{MLInstanceNormalizationOptions/scale}} (if it [=map/exists=]), and |options|.{{MLInstanceNormalizationOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-instanceNormalization)), then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/rank=] is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. Set |options|.{{MLInstanceNormalizationOptions/epsilon}} to the result of [=casting=] |options|.{{MLInstanceNormalizationOptions/epsilon}} to |input|'s [=MLOperand/dataType=]. 1. Let |axis| be 1 if |options|.{{MLInstanceNormalizationOptions/layout}} is {{MLInputOperandLayout/"nchw"}}, and 3 otherwise. 1. If |options|.{{MLInstanceNormalizationOptions/scale}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-instanceNormalization)), then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|axis|] », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLInstanceNormalizationOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-instanceNormalization)), then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |input|'s [=MLOperand/shape=][|axis|] », then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. @@ -4534,7 +4546,8 @@ partial dictionary MLOpSupportLimits { **Returns:** an {{MLOperand}}. The layer-normalized N-D tensor of the same shape as *input*. -
Constraints for {{MLGraphBuilder/instanceNormalization()}}
input operand
+
+ @@ -4571,15 +4584,15 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |options|.{{MLLayerNormalizationOptions/scale}} (if it [=map/exists=]), and |options|.{{MLLayerNormalizationOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-layerNormalization)), then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLayerNormalizationOptions/axes}} does not [=map/exist=], then set |options|.{{MLLayerNormalizationOptions/axes}} to a new [=/list=], either equal to [=the range=] from 1 to |input|'s [=MLOperand/rank=], exclusive, if |input|'s [=MLOperand/rank=] is greater than 1, or an empty [=/list=] otherwise. 1. Otherwise, if |options|.{{MLLayerNormalizationOptions/axes}} contains duplicate values, or if any of its elements is not in [=the range=] 0 to |input|'s [=MLOperand/rank=], exclusive, then return failure. 1. Set |options|.{{MLLayerNormalizationOptions/epsilon}} to the result of [=casting=] |options|.{{MLLayerNormalizationOptions/epsilon}} to |input|'s [=MLOperand/dataType=]. 1. If |options|.{{MLLayerNormalizationOptions/scale}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-layerNormalization)), then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/rank=] is not equal to |options|.{{MLLayerNormalizationOptions/axes}}'s [=list/size=], then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLayerNormalizationOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-layerNormalization)), then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/rank=] is not equal to |options|.{{MLLayerNormalizationOptions/axes}}'s [=list/size=], then [=exception/throw=] a {{TypeError}}. 1. [=list/For each=] |index| in [=the range=] 0 to |options|.{{MLLayerNormalizationOptions/axes}}'s [=list/size=], exclusive: 1. Let |axis| be |options|.{{MLLayerNormalizationOptions/axes}}[|index|]. @@ -4664,7 +4677,8 @@ partial dictionary MLOpSupportLimits { - an {{MLOperand}}. The output tensor of the same shape as *input*. -
Constraints for {{MLGraphBuilder/layerNormalization()}}
input operand
+
+ @@ -4691,7 +4705,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-leakyRelu)), then [=exception/throw=] a {{TypeError}}. 1. Set |options|.{{MLLeakyReluOptions/alpha}} to the result of [=casting=] |options|.{{MLLeakyReluOptions/alpha}} to |input|'s [=MLOperand/dataType=]. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. @@ -4756,7 +4770,8 @@ partial dictionary MLOpSupportLimits { - an {{MLOperand}}. The output tensor of the same shape as *input*. -
Constraints for {{MLGraphBuilder/leakyRelu()}}
input operand
+
+ @@ -4783,7 +4798,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-linear)), then [=exception/throw=] a {{TypeError}}. 1. Set |options|.{{MLLinearOptions/alpha}} to the result of [=casting=] |options|.{{MLLinearOptions/alpha}} to |input|'s [=MLOperand/dataType=]. 1. Set |options|.{{MLLinearOptions/beta}} to the result of [=casting=] |options|.{{MLLinearOptions/beta}} to |input|'s [=MLOperand/dataType=]. 1. *Make graph connections:* @@ -4909,7 +4924,8 @@ partial dictionary MLOpSupportLimits { **Returns:** [=sequence=]<{{MLOperand}}>. The first element is a 3-D tensor of shape *[numDirections, batchSize, hiddenSize]*, the output hidden state from the last time step of the network. The second element is a 3-D tensor of shape *[numDirections, batchSize, hiddenSize]*, the output cell state from the last time step of the network. Additionally, if |options|.{{MLLstmOptions/returnSequence}} is set to true, the third element is the 4-D output tensor of shape *[steps, numDirections, batchSize, hiddenSize]* containing every output from each time step in the temporal sequence. -
Constraints for {{MLGraphBuilder/linear()}}
input operand
+
+ @@ -4994,7 +5010,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |weight|, |recurrentWeight|, |options|.{{MLLstmOptions/bias}} (if it [=map/exists=]), |options|.{{MLLstmOptions/recurrentBias}} (if it [=map/exists=]), |options|.{{MLLstmOptions/peepholeWeight}} (if it [=map/exists=]), |options|.{{MLLstmOptions/initialHiddenState}} (if it [=map/exists=]), and |options|.{{MLLstmOptions/initialCellState}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. 1. Let |numDirections| be 2 if |options|.{{MLLstmOptions/direction}} is {{MLRecurrentNetworkDirection/"both"}}, or 1 otherwise. - 1. If the [=MLOperand/dataType=] of any of |input|, |weight| or |recurrentWeight| is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |input|, |weight| or |recurrentWeight| is not one of its [=/allowed data types=] (according to [this table](#constraints-lstm)), then [=exception/throw=] a {{TypeError}}. 1. If the [=MLOperand/rank=] of any of |input|, |weight| or |recurrentWeight| is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/shape=][0] is not equal to |steps|, then [=exception/throw=] a {{TypeError}}. 1. Let |batchSize| be |input|'s [=MLOperand/shape=][1]. @@ -5007,19 +5023,19 @@ partial dictionary MLOpSupportLimits { Some underlying platforms operate on a single bias tensor which is a concatenation of {{MLLstmOptions/bias}} and {{MLLstmOptions/recurrentBias}}. Therefore, 4 * |hiddenSize| + 4 * |hiddenSize| must also be a [=valid dimension=]. 1. If |options|.{{MLLstmOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-lstm)), then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, 4 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/recurrentBias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-lstm)), then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, 4 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/peepholeWeight}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-lstm)), then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, 3 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/initialHiddenState}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-lstm)), then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, |batchSize|, |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/initialCellState}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-lstm)), then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « |numDirections|, |batchSize|, |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmOptions/activations}} [=map/exists=]: 1. If its [=list/size=] is not 3, then [=exception/throw=] a {{TypeError}}. @@ -5259,7 +5275,8 @@ partial dictionary MLOpSupportLimits { **Returns:** [=sequence=]<{{MLOperand}}>. The first element is the output hidden state of the current time step of the recurrent network. The following element is the output cell state. Both elements are 2-D tensors of shape *[batchSize, hiddenSize]*. -
Constraints for {{MLGraphBuilder/lstm()}}
input operand
+
+ @@ -5343,7 +5360,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |weight|, |recurrentWeight|, |hiddenState|, |cellState|, |options|.{{MLLstmCellOptions/bias}} (if it [=map/exists=]), |options|.{{MLLstmCellOptions/recurrentBias}} (if it [=map/exists=]), and |options|.{{MLLstmCellOptions/peepholeWeight}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of any of |input|, |weight|, |recurrentWeight|, |hiddenState| or |cellState| is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |input|, |weight|, |recurrentWeight|, |hiddenState| or |cellState| is not one of its [=/allowed data types=] (according to [this table](#constraints-lstmCell)), then [=exception/throw=] a {{TypeError}}. 1. If the [=MLOperand/rank=] of any of |input|, |weight|, |recurrentWeight|, |hiddenState| or |cellState| is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. Let |batchSize| be |input|'s [=MLOperand/shape=][0]. 1. Let |inputSize| be |input|'s [=MLOperand/shape=][1]. @@ -5357,13 +5374,13 @@ partial dictionary MLOpSupportLimits { Some underlying platforms operate on a single bias tensor which is a concatenation of {{MLLstmCellOptions/bias}} and {{MLLstmCellOptions/recurrentBias}}. Therefore, 4 * |hiddenSize| + 4 * |hiddenSize| must also be a [=valid dimension=]. 1. If |options|.{{MLLstmCellOptions/bias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-lstmCell)), then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « 4 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmCellOptions/recurrentBias}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-lstmCell)), then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « 4 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmCellOptions/peepholeWeight}} [=map/exists=]: - 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If its [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-lstmCell)), then [=exception/throw=] a {{TypeError}}. 1. If its [=MLOperand/shape=] is not equal to « 3 * |hiddenSize| », then [=exception/throw=] a {{TypeError}}. 1. If |options|.{{MLLstmCellOptions/activations}} [=map/exists=]: 1. If its [=list/size=] is not 3, then [=exception/throw=] a {{TypeError}}. @@ -5542,7 +5559,8 @@ partial dictionary MLOpSupportLimits { - If either *a* or *b* is `N`-dimensional where `N > 2`, it is treated as a stack of matrices with dimensions corresponding to the last two indices. The matrix multiplication will be [=broadcast=] according to [[!numpy-broadcasting-rule]]. The shapes of *a* and *b*, except the last two dimensions, must be [=bidirectionally broadcastable=]. The output is a `N`-dimensional tensor whose rank is the maximum [=MLOperand/rank=] of the input tensors. For each dimension, except the last two, of the output tensor, its size is the maximum size along that dimension of the input tensors. -
Constraints for {{MLGraphBuilder/lstmCell()}}
input operand
+
+ @@ -5595,7 +5613,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |a| and |b| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of any of |a| or |b| is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |a| or |b| is not one of its [=/allowed data types=] (according to [this table](#constraints-matmul)), then [=exception/throw=] a {{TypeError}}. 1. Let |outputShape| be the result of [=MLGraphBuilder/calculating matmul output sizes=] given |a| and |b|. 1. If that throws an error, re-[=exception/throw=] the error. 1. Let |desc| be the result of [=creating an MLOperandDescriptor=] given |a|'s [=MLOperand/dataType=] and |outputShape|. @@ -5993,7 +6011,8 @@ partial dictionary MLOpSupportLimits { - an {{MLOperand}}. The output tensor of the same shape as *input*. -
Constraints for {{MLGraphBuilder/matmul()}}
input operand
+
+ @@ -6034,7 +6053,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input| and |slope| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of any of |input| or |slope| is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If the [=MLOperand/dataType=] of any of |input| or |slope| is not one of its [=/allowed data types=] (according to [this table](#constraints-prelu)), then [=exception/throw=] a {{TypeError}}. 1. Let |outputShape| be to the result of [=bidirectionally broadcasting=] |slope|'s [=MLOperand/shape=] and |input|'s [=MLOperand/shape=]. 1. If that returns failure, then [=exception/throw=] a {{TypeError}}. 1. Let |descriptor| be the result of [=creating an MLOperandDescriptor=] given |input|'s [=MLOperand/dataType=] and |outputShape|. @@ -6321,7 +6340,8 @@ partial dictionary MLOpSupportLimits { - an {{MLOperand}}. The output tensor of the same shape as *input*. -
Constraints for {{MLGraphBuilder/prelu()}}
input operand
+
+ @@ -6348,7 +6368,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-relu)), then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the "relu" operation, given |options|. @@ -6426,7 +6446,8 @@ partial dictionary MLOpSupportLimits { The default value is [2, 3]. -
Constraints for {{MLGraphBuilder/relu()}}
input operand
+
+ @@ -6479,7 +6500,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-resample2d)), then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/rank=] is not its [=/allowed rank=], then [=exception/throw=] a {{TypeError}}. 1. If [=MLGraphBuilder/checking resample options=] given |options| and |input| returns false, then [=exception/throw=] a {{TypeError}}. 1. Let |desc| be the result of [=MLGraphBuilder/calculating resample output sizes=] given |input| and |options|. If that returns failure, then [=exception/throw=] a {{TypeError}}. @@ -6568,7 +6589,8 @@ partial dictionary MLOpSupportLimits { - an {{MLOperand}}. The output tensor of the same shape as *input*. -
Constraints for {{MLGraphBuilder/resample2d()}}
input operand
+
+ @@ -6595,7 +6617,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-sigmoid)), then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the "sigmoid" operation, given |options|. @@ -6700,7 +6722,8 @@ partial dictionary MLOpSupportLimits { - an {{MLOperand}}. The output N-D tensor that contains the softmax results, of the same shape as *input*. -
Constraints for {{MLGraphBuilder/sigmoid()}}
input operand
+
+ @@ -6727,7 +6750,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-softmax)), then [=exception/throw=] a {{TypeError}}. 1. If |axis| is greater than or equal to |input|'s [=MLOperand/rank=], then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. @@ -6782,7 +6805,8 @@ partial dictionary MLOpSupportLimits { - an {{MLOperand}}. The output tensor of the same shape as *input*. -
Constraints for {{MLGraphBuilder/softmax()}}
input operand
+
+ @@ -6809,7 +6833,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-softplus)), then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the "softplus" operation and |options|. @@ -6869,7 +6893,8 @@ partial dictionary MLOpSupportLimits { - an {{MLOperand}}. The output tensor of the same shape as *input*. -
Constraints for {{MLGraphBuilder/softplus()}}
input operand
+
+ @@ -6896,7 +6921,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-softsign)), then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the "softsign" operation and |options|. @@ -7041,7 +7066,8 @@ partial dictionary MLOpSupportLimits { - an {{MLOperand}}. The output tensor of the same shape as *input*. -
Constraints for {{MLGraphBuilder/softsign()}}
input operand
+
+ @@ -7068,7 +7094,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#constraints-tanh)), then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the "tanh" operation, given |options|. @@ -7192,7 +7218,8 @@ partial dictionary MLOpSupportLimits { **Returns:** an {{MLOperand}}. The output tensor representing a triangular matrix, or batch of matrices which is the same shape as the input. -
Constraints for {{MLGraphBuilder/tanh()}}
input operand
+
+ @@ -7219,7 +7246,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If |input|'s [=MLOperand/rank=] is not one of its [=/allowed ranks=], then [=exception/throw=] a {{TypeError}}. + 1. If |input|'s [=MLOperand/rank=] is not one of its [=/allowed ranks=] (according to [this table](#constraints-triangular)), then [=exception/throw=] a {{TypeError}}. 1. *Make graph connections:* 1. Let |output| be the result of [=copying an MLOperand=] given |input|. 1. Let |operator| be an [=operator=] for the "triangular" operation, given |options|. @@ -7325,7 +7352,8 @@ partial dictionary MLOpSupportLimits { **Returns:** an {{MLOperand}}. The output tensor that contains the values selected element-wise from either the trueValue or the falseValue tensor. -
Constraints for {{MLGraphBuilder/triangular()}}
input operand
+
+ @@ -7375,7 +7403,7 @@ partial dictionary MLOpSupportLimits { 1. If [=this=].{{MLGraphBuilder/[[hasBuilt]]}} is true, then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |condition|, |trueValue|, and |falseValue| returns false, then [=exception/throw=] a {{TypeError}}. - 1. If the [=MLOperand/dataType=] of any of |condition|, |trueValue|, or |falseValue| is not one of its [=/allowed data types=], then [=exception/throw=] a {{TypeError}}. + 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]. From f61292d64b86ca4088d9a4e886d634ea65634fce Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Mon, 11 Nov 2024 15:44:44 -0800 Subject: [PATCH 15/20] Add tables for all ops --- index.bs | 338 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 294 insertions(+), 44 deletions(-) diff --git a/index.bs b/index.bs index 5df617ae..e35b60dd 100644 --- a/index.bs +++ b/index.bs @@ -1562,6 +1562,22 @@ partial dictionary MLOpSupportLimits { **Returns:** an {{MLOperand}}. The N-D tensor of the reduced shape. The values must be of type |options|.{{MLArgMinMaxOptions/outputDataType}} in the range [0, N-1] where N is the size of the input dimension specified by axis. +
Constraints for {{MLGraphBuilder/where()}}
input operand
+ + + + + + + + + + + + + +
Constraints for {{MLGraphBuilder/argMin()}}/{{MLGraphBuilder/argMax()}}
input operand[=/allowed data types=][=/allowed ranks=]
{{input}}[=/any data type|any=][=/any rank|N=]
+ {{MLOpSupportLimits}} has the following members for {{MLGraphBuilder/argMin()}} and {{MLGraphBuilder/argMax()}}:
: argMin @@ -1669,7 +1685,7 @@ partial dictionary MLOpSupportLimits { - + @@ -1800,6 +1816,22 @@ partial dictionary MLOpSupportLimits { **Returns:** an {{MLOperand}}. The N-D tensor of the same shape as *input* with each element casted to the target data type. +
Constraints for {{MLGraphBuilder/batchNormalization()}}
input operand [=/allowed data types=]
+ + + + + + + + + + + + + +
Constraints for {{MLGraphBuilder/cast()}}
input operand[=/allowed data types=][=/allowed ranks=]
{{input}}[=/any data type|any=][=/any rank|N=]
+ {{MLOpSupportLimits}} has the following members for {{MLGraphBuilder/cast()}}:
: cast @@ -1919,6 +1951,22 @@ partial dictionary MLOpSupportLimits { - an {{MLOperand}}. The output tensor of the same shape as *input*. + + + + + + + + + + + + + + +
Constraints for {{MLGraphBuilder/clamp()}}
input operand[=/allowed data types=][=/allowed ranks=]
{{input}}[=/any data type|any=][=/any rank|N=]
+ {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/clamp()}}:
: clamp @@ -2005,6 +2053,22 @@ partial dictionary MLOpSupportLimits { computed as the sum of all the input sizes of the same dimension. + + + + + + + + + + + + + + +
Constraints for {{MLGraphBuilder/concat()}}
input operand[=/allowed data types=][=/allowed ranks=]
{{inputs}}[=/any data type|any=][=/any rank|N=]
+ {{MLConcatSupportLimits}} has the following members:
: inputs @@ -2151,7 +2215,7 @@ partial dictionary MLOpSupportLimits { - + @@ -2389,7 +2453,7 @@ partial dictionary MLOpSupportLimits {
Constraints for {{MLGraphBuilder/conv2d()}}
input operand [=/allowed data types=]
- + @@ -2554,6 +2618,27 @@ partial dictionary MLOpSupportLimits { - *pow*: Compute the values of the values of the first input tensor to the power of the values of the second input tensor, element-wise. +
Constraints for {{MLGraphBuilder/convTranspose2d()}}
input operand [=/allowed data types=]
+ + + + + + + + + + + + + + + + + + +
Constraints for element-wise binary options
input operand[=/allowed data types=][=/allowed ranks=]
{{a}}[=/any data type|any=][=/any rank|N=]
{{b}}[=/same as=] {{a}}[=/any rank|N=]
+ {{MLOpSupportLimits}} has the following members for elementwise-binary operations:
: add @@ -2695,6 +2780,28 @@ partial dictionary MLOpSupportLimits { **Returns:** an {{MLOperand}}. The output tensor that contains the result of element-wise comparison of the two input tensors. + + + + + + + + + + + + + + + + + + + +
Constraints for element-wise logical options
input operand[=/allowed data types=][=/allowed ranks=]
{{a}}[=/any data type|any=][=/any rank|N=]
{{b}}[=/same as=] {{a}}[=/any rank|N=]
+ + {{MLLogicalNotSupportLimits}} has the following members:
: a @@ -2850,6 +2957,23 @@ partial dictionary MLOpSupportLimits { tensor is the same as the shape of input tensor. + + + + + + + + + + + + + + +
Constraints for element-wise unary options
input operand[=/allowed data types=][=/allowed ranks=]
{{input}}specified as part of operation steps[=/any rank|N=]
+ + {{MLOpSupportLimits}} has the following members for element-wise unary operations:
: abs @@ -3044,7 +3168,7 @@ partial dictionary MLOpSupportLimits { - + @@ -3122,6 +3246,22 @@ partial dictionary MLOpSupportLimits { **Returns:** an {{MLOperand}}. The tensor with expanded size shape. +
Constraints for {{MLGraphBuilder/elu()}}
input operand [=/allowed data types=]
+ + + + + + + + + + + + + +
Constraints for {{MLGraphBuilder/expand()}}
input operand[=/allowed data types=][=/allowed ranks=]
{{input}}[=/any data type|any=][=/any rank|N=]
+ {{MLOpSupportLimits}} has the following members for {{MLGraphBuilder/expand()}}:
: expand @@ -3186,29 +3326,13 @@ partial dictionary MLOpSupportLimits { **Returns:** an {{MLOperand}}. The output N-D tensor of [=MLOperand/rank=] equal to the [=MLOperand/rank=] of *input* + the [=MLOperand/rank=] of *indices* - 1. -{{MLGatherSupportLimits}} has the following members: -
- : input - :: {{MLSupportLimits}} for input operand. - : indices - :: {{MLSupportLimits}} for indices operand. - : output - :: {{MLSupportLimits}} for output operand. -
- -{{MLOpSupportLimits}} has the following members for {{MLGraphBuilder/gather()}}: -
- : gather - :: Support limits for operator {{MLGraphBuilder/gather()}}. -
-
The {{MLGraphBuilder/gather(input, indices, options)/indices}} parameter to {{MLGraphBuilder/gather()}} can not be clamped to the allowed range when the graph is built because the inputs are not known until execution. Implementations can introduce {{MLGraphBuilder/clamp()}} in the compiled graph if the required clamping behavior is not provided by the underlying platform. Similarly, if the underlying platform does not support negative indices, the implementation can introduce operations in the compiled graph to transform a negative index from the end of the dimension into a positive index.
- + @@ -3227,6 +3351,21 @@ partial dictionary MLOpSupportLimits {
Constraints for {{MLGraphBuilder/gather()}}
input operand [=/allowed data types=]
+{{MLGatherSupportLimits}} has the following members: +
+ : input + :: {{MLSupportLimits}} for input operand. + : indices + :: {{MLSupportLimits}} for indices operand. + : output + :: {{MLSupportLimits}} for output operand. +
+ +{{MLOpSupportLimits}} has the following members for {{MLGraphBuilder/gather()}}: +
+ : gather + :: Support limits for operator {{MLGraphBuilder/gather()}}. +
@@ -3347,7 +3486,7 @@ partial dictionary MLOpSupportLimits { - + @@ -3463,7 +3602,7 @@ partial dictionary MLOpSupportLimits {
Constraints for {{MLGraphBuilder/gelu()}}
input operand [=/allowed data types=]
- + @@ -3665,7 +3804,7 @@ partial dictionary MLOpSupportLimits {
Constraints for {{MLGraphBuilder/gemm()}}
input operand [=/allowed data types=]
- + @@ -3962,7 +4101,7 @@ partial dictionary MLOpSupportLimits {
Constraints for {{MLGraphBuilder/gru()}}
input operand [=/allowed data types=]
- + @@ -4204,7 +4343,7 @@ partial dictionary MLOpSupportLimits {
Constraints for {{MLGraphBuilder/gruCell()}}
input operand [=/allowed data types=]
- + @@ -4284,7 +4423,7 @@ partial dictionary MLOpSupportLimits {
Constraints for {{MLGraphBuilder/hardSigmoid()}}
input operand [=/allowed data types=]
- + @@ -4399,7 +4538,7 @@ partial dictionary MLOpSupportLimits {
Constraints for {{MLGraphBuilder/hardSwish()}}
input operand [=/allowed data types=]
- + @@ -4548,7 +4687,7 @@ partial dictionary MLOpSupportLimits {
Constraints for {{MLGraphBuilder/instanceNormalization()}}
input operand [=/allowed data types=]
- + @@ -4679,7 +4818,7 @@ partial dictionary MLOpSupportLimits {
Constraints for {{MLGraphBuilder/layerNormalization()}}
input operand [=/allowed data types=]
- + @@ -4772,7 +4911,7 @@ partial dictionary MLOpSupportLimits {
Constraints for {{MLGraphBuilder/leakyRelu()}}
input operand [=/allowed data types=]
- + @@ -4926,7 +5065,7 @@ partial dictionary MLOpSupportLimits {
Constraints for {{MLGraphBuilder/linear()}}
input operand [=/allowed data types=]
- + @@ -5277,7 +5416,7 @@ partial dictionary MLOpSupportLimits {
Constraints for {{MLGraphBuilder/lstm()}}
input operand [=/allowed data types=]
- + @@ -5561,7 +5700,7 @@ partial dictionary MLOpSupportLimits {
Constraints for {{MLGraphBuilder/lstmCell()}}
input operand [=/allowed data types=]
- + @@ -5676,6 +5815,22 @@ partial dictionary MLOpSupportLimits { `output size = beginning padding + input size + ending padding` +
Constraints for {{MLGraphBuilder/matmul()}}
input operand [=/allowed data types=]
+ + + + + + + + + + + + + +
Constraints for {{MLGraphBuilder/pad()}}
input operand[=/allowed data types=][=/allowed ranks=]
{{input}}[=/any data type|any=][=/any rank|N=]
+ {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/pad()}}:
: pad @@ -5855,6 +6010,22 @@ partial dictionary MLOpSupportLimits { `output size = ceil(1 + (input size - filter size + beginning padding + ending padding) / stride)` + + + + + + + + + + + + + + +
Constraints for pooling operations
input operand[=/allowed data types=][=/allowed ranks=]
{{input}}specified as part of operation steps4
+ {{MLOpSupportLimits}} has the following members for pooling operations:
: averagePool2d @@ -6013,7 +6184,7 @@ partial dictionary MLOpSupportLimits { - + @@ -6143,6 +6314,22 @@ partial dictionary MLOpSupportLimits { **Returns:** an {{MLOperand}}. The reduced output tensor. If the input operand is a scalar, the reduction function is applied to the scalar value, and the output is also a scalar. +
Constraints for {{MLGraphBuilder/prelu()}}
input operand [=/allowed data types=]
+ + + + + + + + + + + + + +
Constraints for reduction-operations
input operand[=/allowed data types=][=/allowed ranks=]
{{input}}[=/any data type|any=][=/any rank|N=]
+ {{MLOpSupportLimits}} has the following members for reduction operations:
: reduceL1 @@ -6342,7 +6529,7 @@ partial dictionary MLOpSupportLimits { - + @@ -6448,7 +6635,7 @@ partial dictionary MLOpSupportLimits {
Constraints for {{MLGraphBuilder/relu()}}
input operand [=/allowed data types=]
- + @@ -6539,6 +6726,22 @@ partial dictionary MLOpSupportLimits { tensor is specified by the *newShape* argument. +
Constraints for {{MLGraphBuilder/resample2d()}}
input operand [=/allowed data types=]
+ + + + + + + + + + + + + +
Constraints for {{MLGraphBuilder/reshape()}}
input operand[=/allowed data types=][=/allowed ranks=]
{{input}}[=/any data type|any=][=/any rank|N=]
+ {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/reshape()}}:
: reshape @@ -6591,7 +6794,7 @@ partial dictionary MLOpSupportLimits { - + @@ -6667,6 +6870,22 @@ partial dictionary MLOpSupportLimits { **Returns:** an {{MLOperand}}. The output tensor of the same rank as the input tensor with tensor values stripped to the specified starting and ending indices in each dimension. +
Constraints for {{MLGraphBuilder/sigmoid()}}
input operand [=/allowed data types=]
+ + + + + + + + + + + + + +
Constraints for {{MLGraphBuilder/slice()}}
input operand[=/allowed data types=][=/allowed ranks=]
{{input}}[=/any data type|any=][=/any rank|N=]
+ {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/slice()}}:
: slice @@ -6724,7 +6943,7 @@ partial dictionary MLOpSupportLimits { - + @@ -6807,7 +7026,7 @@ partial dictionary MLOpSupportLimits {
Constraints for {{MLGraphBuilder/softmax()}}
input operand [=/allowed data types=]
- + @@ -6895,7 +7114,7 @@ partial dictionary MLOpSupportLimits {
Constraints for {{MLGraphBuilder/softplus()}}
input operand [=/allowed data types=]
- + @@ -6971,6 +7190,21 @@ partial dictionary MLOpSupportLimits { The dimension along which to split. Its value must be in the range [0, N-1] where N is the [=MLOperand/rank=] of the input tensor. +
Constraints for {{MLGraphBuilder/softsign()}}
input operand [=/allowed data types=]
+ + + + + + + + + + + + + +
Constraints for {{MLGraphBuilder/split()}}
input operand[=/allowed data types=][=/allowed ranks=]
{{input}}[=/any data type|any=][=/any rank|N=]
{{MLSplitSupportLimits}} has the following members:
@@ -7068,7 +7302,7 @@ partial dictionary MLOpSupportLimits { - + @@ -7156,6 +7390,22 @@ partial dictionary MLOpSupportLimits { **Returns:** an {{MLOperand}}. The permuted or transposed N-D tensor. +
Constraints for {{MLGraphBuilder/tanh()}}
input operand [=/allowed data types=]
+ + + + + + + + + + + + + +
Constraints for {{MLGraphBuilder/transpose()}}
input operand[=/allowed data types=][=/allowed ranks=]
{{input}}[=/any data type|any=][=/any rank|N=]
+ {{MLOpSupportLimits}} has the following member for {{MLGraphBuilder/transpose()}}:
: transpose @@ -7220,7 +7470,7 @@ partial dictionary MLOpSupportLimits { - + @@ -7354,7 +7604,7 @@ partial dictionary MLOpSupportLimits {
Constraints for {{MLGraphBuilder/triangular()}}
input operand [=/allowed data types=]
- + From 4bf14f6504ba0587d33ee4439cc5e05f7f081085 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Mon, 11 Nov 2024 16:07:49 -0800 Subject: [PATCH 16/20] Allow allowed ranks to be a range --- index.bs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.bs b/index.bs index e35b60dd..643e1a47 100644 --- a/index.bs +++ b/index.bs @@ -1278,7 +1278,7 @@ Since the {{MLOperand/[[builder]]}} object is bound by the {{MLGraphBuilder/cons 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 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. +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. {{MLOperatorOptions}} has the following members:
@@ -3622,7 +3622,7 @@ partial dictionary MLOpSupportLimits {
- +
Constraints for {{MLGraphBuilder/where()}}
input operand [=/allowed data types=]
{{MLGemmOptions/c}} [=/same as=] {{a}}[=/any rank|N=]0 to 2
@@ -4702,12 +4702,12 @@ partial dictionary MLOpSupportLimits { {{MLLayerNormalizationOptions/scale}} [=/same as=] {{input}} - [=/any rank|N=] + 0 to {{input}}'s [=MLOperand/rank=] {{MLLayerNormalizationOptions/bias}} [=/same as=] {{input}} - [=/any rank|N=] + 0 to {{input}}'s [=MLOperand/rank=] @@ -6198,7 +6198,7 @@ partial dictionary MLOpSupportLimits { {{slope}} [=/same as=] {{input}} - [=/any rank|N=] + 0 to {{input}}'s [=MLOperand/rank=] From db8d1e21ef42e7897fd7143d41dea07194dee96c Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Tue, 12 Nov 2024 10:16:07 -0800 Subject: [PATCH 17/20] elementwise-logical and reduction types are given in op steps --- index.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index 643e1a47..af3825cc 100644 --- a/index.bs +++ b/index.bs @@ -2791,7 +2791,7 @@ partial dictionary MLOpSupportLimits { {{a}} - [=/any data type|any=] + specified as part of operation steps [=/any rank|N=] @@ -6325,7 +6325,7 @@ partial dictionary MLOpSupportLimits { {{input}} - [=/any data type|any=] + specified as part of operation steps [=/any rank|N=] From bd425cb0afdace3cabb40ed212465855b3c54f0d Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Tue, 12 Nov 2024 10:25:56 -0800 Subject: [PATCH 18/20] align spelling of 'element-wise binary' with rest of spec --- index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.bs b/index.bs index af3825cc..8d52c1d5 100644 --- a/index.bs +++ b/index.bs @@ -2639,7 +2639,7 @@ partial dictionary MLOpSupportLimits { -{{MLOpSupportLimits}} has the following members for elementwise-binary operations: +{{MLOpSupportLimits}} has the following members for element-wise binary operations:
: add :: Support limits for operator {{MLGraphBuilder/add()}}. From 8e540f3b047ec16f49eee284c4686d59bd917925 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Tue, 12 Nov 2024 21:35:51 -0800 Subject: [PATCH 19/20] restore prelu's slope's rank to 'any' --- index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.bs b/index.bs index 8d52c1d5..f16c3861 100644 --- a/index.bs +++ b/index.bs @@ -6198,7 +6198,7 @@ partial dictionary MLOpSupportLimits { {{slope}} [=/same as=] {{input}} - 0 to {{input}}'s [=MLOperand/rank=] + [=/any rank|N=] From 88a7a12b3becf8759e32e11fa80b87948ad6afb9 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Fri, 15 Nov 2024 10:04:55 -0800 Subject: [PATCH 20/20] Apply suggestions from code review Fix copy/pasta of {{input}} for other params Co-authored-by: Dwayne Robinson --- index.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index f16c3861..6bb68043 100644 --- a/index.bs +++ b/index.bs @@ -2234,7 +2234,7 @@ partial dictionary MLOpSupportLimits { {{MLConv2dOptions/bias}} - {{input}} + [=/same as=] {{input}} 1 @@ -2472,7 +2472,7 @@ partial dictionary MLOpSupportLimits { {{MLConv2dOptions/bias}} - {{input}} + [=/same as=] {{input}} 1