diff --git a/index.bs b/index.bs index a394d073..2abbbae1 100644 --- a/index.bs +++ b/index.bs @@ -966,7 +966,7 @@ The {{MLOperand}} objects are created by the methods of {{MLGraphBuilder}}, inte
1. [=Assert=]: the type of |builder| is {{MLGraphBuilder}}. - 1. If |desc| is not an [=object=] that [=implements=] {{MLOperandDescriptor}}, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If |desc| is not an [=object=] that [=implements=] {{MLOperandDescriptor}}, then [=exception/throw=] a {{TypeError}} and stop. 1. Let |operand| be a new [=object=]. 1. Set |operand|.{{MLOperand/[[builder]]}} to |builder|. 1. Set |operand|.{{MLOperand/[[descriptor]]}} to |desc|. @@ -1607,9 +1607,9 @@ Create a named {{MLOperand}} based on a descriptor, that can be used as an input The permissions and context validity have been checked by [[#api-mlgraphbuilder-constructor]] steps.
1. Let |name| be the first argument. - 1. If |name| is `undefined` or an empty [=string=], then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If |name| is `undefined` or an empty [=string=], then [=exception/throw=] a {{TypeError}} and stop. 1. Let |descriptor| be the second argument. - 1. If |descriptor| is not an an object that [=implements=] {{MLOperandDescriptor}}, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If |descriptor| is not an an object that [=implements=] {{MLOperandDescriptor}}, then [=exception/throw=] a {{TypeError}} and stop. 1. [=Assert=]: If |descriptor|.{{MLOperandDescriptor/dimensions}} does not [=map/exist=], then |descriptor| defines a scalar input. 1. If |descriptor|.{{MLOperandDescriptor/dimensions}} [=map/exists=]: 1. If the [=check dimensions=] steps given |descriptor|.{{MLOperandDescriptor/type}} and |descriptor|.{{MLOperandDescriptor/dimensions}} return `false`, throw a "{{DataError}}" {{DOMException}} and stop. @@ -1654,10 +1654,10 @@ Build a composed graph up to a given output operand into a computational graph, The permissions and context validity have been checked by [[#api-mlgraphbuilder-constructor]] steps. 1. [=Assert=]: the type of |outputs| is {{MLNamedOperands}}. - 1. If |outputs| is empty, then throw an "{{TypeError}}" {{DOMException}} and stop. + 1. If |outputs| is empty, then [=exception/throw=] a {{TypeError}} and stop. 1. For each |element| in |outputs|: 1. [=Assert=]: the type of |element|.key is [=string=]. - 1. If |element|.key is empty, then throw an "{{TypeError}}" {{DOMException}} and stop. + 1. If |element|.key is empty, then [=exception/throw=] a {{TypeError}} and stop. 1. [=Assert=]: the type of |element|.value is {{MLOperand}}. 1. If any of the following sub-steps fail, throw an "{{OperationError}}" {{DOMException}} and stop. 1. Let |graph| be a new {{MLGraph}}: @@ -1667,9 +1667,9 @@ Build a composed graph up to a given output operand into a computational graph, 1. Store a reference to |graphImpl| in |graph|.{{MLGraph/[[implementation]]}}. 1. Make a request to the underlying platform to initialize the graph: 1. For each |operand| in |outputs|: - 1. If running the validate MLOperand given |operand| and [=this=] returns `false`, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If running the validate MLOperand given |operand| and [=this=] returns `false`, then [=exception/throw=] a {{TypeError}} and stop. 1. If |operand| was created as an input by the underlying platform: - 1. If |operand|.{{MLOperand/[[name]]}}] is not unique for |graphImpl|, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If |operand|.{{MLOperand/[[name]]}}] is not unique for |graphImpl|, then [=exception/throw=] a {{TypeError}} and stop. 1. Add |operand|.{{MLOperand/[[descriptor]]}} to |graph|.{{MLGraph/[[inputDescriptors]]}}[|operand|.{{MLOperand/[[name]]}}]. 1. If |operand| was created as a constant by the underlying platform: 1. Implementations MAY preprocess and optimize the tensor data of |operand| for the underlying platform. @@ -1699,11 +1699,11 @@ Create a constant {{MLOperand}} that can be used in {{MLGraphBuilder}} methods. The permissions and context validity have been checked by [[#api-mlgraphbuilder-constructor]] steps. 1. Let |descriptor| be the first argument. - 1. If |descriptor| is not an an object that [=implements=] {{MLOperandDescriptor}}, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If |descriptor| is not an an object that [=implements=] {{MLOperandDescriptor}}, then [=exception/throw=] a {{TypeError}} and stop. 1. If the [=byte length=] of |descriptor| is not supported by the underlying platform, then throw a "{{DataError}}" {{DOMException}} and stop. 1. If the [=check dimensions=] steps given |descriptor|.{{MLOperandDescriptor/type}} and |descriptor|.{{MLOperandDescriptor/dimensions}} return `false`, throw a "{{DataError}}" {{DOMException}} and stop. 1. Let |bufferView| be the second argument. - 1. If invoking validate buffer with descriptor given |bufferView| and |descriptor| return `false`, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If invoking validate buffer with descriptor given |bufferView| and |descriptor| return `false`, then [=exception/throw=] a {{TypeError}} and stop. 1. If any of the following sub-steps fail, throw an "{{OperationError}}" {{DOMException}} and stop. 1. Let |operand| be the result of invoking the create MLOperand steps with [=this=] and |descriptor|. 1. Let |bytes| be the result of invoking [[=get a copy of the bytes held by the buffer source=]] given |bufferView|. @@ -1732,9 +1732,8 @@ Create a constant {{MLOperand}} that can be used in {{MLGraphBuilder}} methods.
The permissions and context validity have been checked by [[#api-mlgraphbuilder-constructor]] steps.
- 1. If |value| is not a [=number=], then throw a "{{TypeError}}" {{DOMException}} and stop. - 1. If |type| is `undefined`, let |type| be `"float32"`. - 1. Otherwise, if |type| is not one of {{MLOperandType}}, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If |value| is not a [=number=], then [=exception/throw=] a {{TypeError}} and stop. + 1. Otherwise, if |type| is not one of {{MLOperandType}}, then [=exception/throw=] a {{TypeError}} and stop. 1. Let |descriptor| be a new {{MLOperandDescriptor}}. 1. Set |descriptor|.{{MLOperandDescriptor/type}} to |type|. 1. Set |descriptor|.{{MLOperandDescriptor/dimensions}} to `undefined`. @@ -1808,14 +1807,14 @@ partial interface MLGraphBuilder {
1. Let |input| be the first argument. To validate |input|, run these substeps: - 1. If |input| is not an [=object=] that [=implements=] {{MLOperand}}, then throw a "{{TypeError}}" {{DOMException}} and abort these steps. + 1. If |input| is not an [=object=] that [=implements=] {{MLOperand}}, then [=exception/throw=] a {{TypeError}} and abort these steps. 1. Let |mean| be the second argument, representing a vector with the moving mean values for |input|. To validate |mean|, run the following substeps: - 1. If |mean| is not an [=object=] that [=implements=] {{MLOperand}}, then throw a "{{TypeError}}" {{DOMException}} and abort these steps. - 1. If |mean|.{{MLOperand/[[descriptor]]}}.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}} is not equal with |input|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}} from which the dimension represented by |options|.axis is removed, then throw a "{{TypeError}}" {{DOMException}} and abort these steps. + 1. If |mean| is not an [=object=] that [=implements=] {{MLOperand}}, then [=exception/throw=] a {{TypeError}} and abort these steps. + 1. If |mean|.{{MLOperand/[[descriptor]]}}.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}} is not equal with |input|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}} from which the dimension represented by |options|.axis is removed, then [=exception/throw=] a {{TypeError}} and abort these steps. 1. Let |variance| be the third argument, representing the moving variance values of |input|. 1. Let |options| be the fourth argument. To validate |options|, run these substeps: 1. If |options|.axis does not [=map/exist=], let |options|."axis" be 1. - 1. If |options|.axis is not a number between 0 and the rank of |input|, then throw a "{{TypeError}}" {{DOMException}} and abort these steps. + 1. If |options|.axis is not a number between 0 and the rank of |input|, then [=exception/throw=] a {{TypeError}} and abort these steps. 1. If |input| is a 4-D tensor of the *"nchw"* layout, set |options|.axis to 1. 1. If |input| is a 4-D tensor of the *"nhwc"* layout, set |options|.axis to 3. 1. If any of the following sub-steps fail, throw an "{{OperationError}}" {{DOMException}} and stop. @@ -1921,7 +1920,7 @@ partial interface MLGraphBuilder {
1. Let |operand| be the first argument. 1. Let |options| be the second argument. - 1. If running the check clamp options steps with |options| returns `false`, then throw a "{{TypeError}}" {{DOMException}} and abort these steps. + 1. If running the check clamp options steps with |options| returns `false`, then [=exception/throw=] a {{TypeError}} and abort these steps. 1. If any of the following sub-steps fail, throw an "{{OperationError}}" {{DOMException}} and stop. 1. Let |output| be the result of invoking the copy MLOperand steps given |operand|. 1. Make a request to the underlying platform to: @@ -1951,7 +1950,7 @@ partial interface MLGraphBuilder {
1. Let |options| be the first argument. - 1. If running the check clamp options steps with |options| returns `false`, then throw a "{{TypeError}}" {{DOMException}} and abort these steps. + 1. If running the check clamp options steps with |options| returns `false`, then [=exception/throw=] a {{TypeError}} and abort these steps. 1. Let |op| be the result of invoking the create MLActivation steps with `"clamp"` and |options|. 1. If that throws an error, re-throw the error and abort these steps. 1. Return |op|. @@ -2148,15 +2147,15 @@ partial interface MLGraphBuilder { 1. Let |filter_size| be the size of |filter|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}}. 1. If |input_size| is not `4`, then throw a "{{DataError}}" {{DOMException}} and stop. 1. If |filter_size| is not `4`, then throw a "{{DataError}}" {{DOMException}} and stop. - 1. If the type of |input| and |filter| is not the same, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If the type of |input| and |filter| is not the same, then [=exception/throw=] a {{TypeError}} and stop. 1. If |options| is `undefined`, let |options| be an empty [=object=]. 1. If |options|.{{MLConv2dOptions/padding}} is `undefined`, set it to `[0, 0, 0, 0]`. 1. Else if |options|.{{MLConv2dOptions/padding}}.length is not 4, then throw a "{{DataError}}" {{DOMException}} and stop. 1. If |options|.{{MLConv2dOptions/strides}} is `undefined`, set it to `[1, 1]`. - 1. Else if |options|.{{MLConv2dOptions/strides}}.length is not `2`, then throw a "{{TypeError}}" {{DOMException}} and stop. - 1. If any element in |options|.{{MLConv2dOptions/strides}} is equal to 0, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. Else if |options|.{{MLConv2dOptions/strides}}.length is not `2`, then [=exception/throw=] a {{TypeError}} and stop. + 1. If any element in |options|.{{MLConv2dOptions/strides}} is equal to 0, then [=exception/throw=] a {{TypeError}} and stop. 1. If |options|.{{MLConv2dOptions/dilations}} is `undefined`, set it to `[1, 1]`. - 1. Else if |options|.{{MLConv2dOptions/dilations}}.length is not `2`, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. Else if |options|.{{MLConv2dOptions/dilations}}.length is not `2`, then [=exception/throw=] a {{TypeError}} and stop. 1. If |options|.{{MLConv2dOptions/autoPad}} is `undefined`, set it to `"explicit"`. 1. If |options|.{{MLConv2dOptions/groups}} is `undefined`, set it to `1`. 1. Else if |options|.{{MLConv2dOptions/groups}} is 0, then throw a "{{DataError}}" {{DOMException}} and stop. @@ -2166,8 +2165,8 @@ partial interface MLGraphBuilder { 1. If |options|.{{MLConv2dOptions/filterLayout}} is `undefined`, set it to `"oihw"`. 1. If |options|.{{MLConv2dOptions/bias}} [=map/exists=]: 1. [=Assert=]: the type of |options|.{{MLConv2dOptions/bias}} is {{MLOperand}}. - 1. If the length of |options|.{{MLConv2dOptions/bias}}.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}} is not 1, then throw a "{{TypeError}}" {{DOMException}} and stop. - 1. If |options|.{{MLConv2dOptions/bias}}.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/type}} is not the same as |input|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/type}}, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If the length of |options|.{{MLConv2dOptions/bias}}.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}} is not 1, then [=exception/throw=] a {{TypeError}} and stop. + 1. If |options|.{{MLConv2dOptions/bias}}.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/type}} is not the same as |input|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/type}}, then [=exception/throw=] a {{TypeError}} and stop. 1. If |options|.{{MLConv2dOptions/activation}} [=map/exists=]: 1. [=Assert=]: the type of |options|.{{MLConv2dOptions/activation}} is {{MLActivation}}. 1. Let |output_shape| be the result of invoking the underlying implementation for calculating output dimensions, given |options|. @@ -2327,19 +2326,19 @@ partial interface MLGraphBuilder { 1. Let |filter_size| be the size of |filter|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}}. 1. If |input_size| is not `4`, then throw a "{{DataError}}" {{DOMException}} and stop. 1. If |filter_size| is not `4`, then throw a "{{DataError}}" {{DOMException}} and stop. - 1. If the type of |input| and |filter| is not the same, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If the type of |input| and |filter| is not the same, then [=exception/throw=] a {{TypeError}} and stop. 1. If |options| is `undefined`, let |options| be an empty [=object=]. 1. If |options|.{{MLConvTranspose2dOptions/padding}} is `undefined`, set it to `[0, 0, 0, 0]`. 1. Else if |options|.{{MLConvTranspose2dOptions/padding}}.length is not 4, then throw a "{{DataError}}" {{DOMException}} and stop. 1. If |options|.{{MLConvTranspose2dOptions/strides}} is `undefined`, set it to `[1, 1]`. - 1. Else if |options|.{{MLConvTranspose2dOptions/strides}}.length is not `2`, then throw a "{{TypeError}}" {{DOMException}} and stop. - 1. If any element in |options|.{{MLConv2dOptions/strides}} is equal to 0, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. Else if |options|.{{MLConvTranspose2dOptions/strides}}.length is not `2`, then [=exception/throw=] a {{TypeError}} and stop. + 1. If any element in |options|.{{MLConv2dOptions/strides}} is equal to 0, then [=exception/throw=] a {{TypeError}} and stop. 1. If |options|.{{MLConvTranspose2dOptions/dilations}} is `undefined`, set it to `[1, 1]`. - 1. Else if |options|.{{MLConvTranspose2dOptions/dilations}}.length is not `2`, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. Else if |options|.{{MLConvTranspose2dOptions/dilations}}.length is not `2`, then [=exception/throw=] a {{TypeError}} and stop. 1. If |options|.{{MLConvTranspose2dOptions/outputPadding}} is `undefined`, set it to `[0, 0]`. - 1. Else if |options|.{{MLConvTranspose2dOptions/outputPadding}}.length is not `2`, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. Else if |options|.{{MLConvTranspose2dOptions/outputPadding}}.length is not `2`, then [=exception/throw=] a {{TypeError}} and stop. 1. If |options|.{{MLConvTranspose2dOptions/outputSizes}} [=map/exists=]: - 1. If |options|.{{MLConvTranspose2dOptions/outputSizes}}.length is not `2`, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If |options|.{{MLConvTranspose2dOptions/outputSizes}}.length is not `2`, then [=exception/throw=] a {{TypeError}} and stop. 1. If the elements of |options|.{{MLConvTranspose2dOptions/outputSizes}} are not smaller than the elements at the same dimension (index) for |options|.{{MLConvTranspose2dOptions/strides}}, then throw a "{{DataError}}" {{DOMException}} and stop. 1. If |options|.{{MLConvTranspose2dOptions/autoPad}} is `undefined`, set it to `"explicit"`. 1. If |options|.{{MLConvTranspose2dOptions/groups}} is `undefined`, set it to `1`. @@ -2349,8 +2348,8 @@ partial interface MLGraphBuilder { 1. If |options|.{{MLConvTranspose2dOptions/filterLayout}} is `undefined`, set it to `"iohw"`. 1. If |options|.{{MLConvTranspose2dOptions/bias}} [=map/exists=]: 1. [=Assert=]: the type of |options|.{{MLConvTranspose2dOptions/bias}} is {{MLOperand}}. - 1. If the length of |options|.{{MLConvTranspose2dOptions/bias}}.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}} is not 1, then throw a "{{TypeError}}" {{DOMException}} and stop. - 1. If |options|.{{MLConvTranspose2dOptions/bias}}.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/type}} is not the same as |input|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/type}}, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If the length of |options|.{{MLConvTranspose2dOptions/bias}}.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}} is not 1, then [=exception/throw=] a {{TypeError}} and stop. + 1. If |options|.{{MLConvTranspose2dOptions/bias}}.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/type}} is not the same as |input|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/type}}, then [=exception/throw=] a {{TypeError}} and stop. 1. If |options|.{{MLConvTranspose2dOptions/activation}} [=map/exists=]: 1. [=Assert=]: the type of |options|.{{MLConvTranspose2dOptions/activation}} is {{MLActivation}}. 1. Let |output_shape| be the result of invoking the underlying implementation for calculating output dimensions, given |options|. @@ -2668,7 +2667,7 @@ partial interface MLGraphBuilder {
1. Let |input| be the first argument. 1. Let |options| be the second argument. - 1. If running the check ELU options steps with |options| returns `false`, then throw a "{{TypeError}}" {{DOMException}} and abort these steps. + 1. If running the check ELU options steps with |options| returns `false`, then [=exception/throw=] a {{TypeError}} and abort these steps. 1. If any of the following sub-steps fail, throw an "{{OperationError}}" {{DOMException}} and stop. 1. Let |output| be the result of invoking the copy MLOperand steps given |input|. 1. Make a request to the underlying platform to: @@ -2699,7 +2698,7 @@ partial interface MLGraphBuilder {
1. Let |options| be the first argument. 1. If |options| is `undefined`, let |options| be a new {{MLEluOptions}} object. - 1. If running the check ELU options steps with |options| returns `false`, then throw a "{{TypeError}}" {{DOMException}} and abort these steps. + 1. If running the check ELU options steps with |options| returns `false`, then [=exception/throw=] a {{TypeError}} and abort these steps. 1. Let |op| be the result of invoking the create MLActivation steps with `"elu"` and |options|. 1. Return |op|.
@@ -2913,11 +2912,11 @@ partial interface MLGraphBuilder { 1. If |options|.{{MLGruOptions/resetAfter}} is `undefined`, set it to `true`. 1. If |options|.{{MLGruOptions/returnSequence}} is `undefined`, set it to `false`. 1. If |options|.{{MLGruOptions/direction}} is `undefined`, set it to `"forward"`. - 1. If |options|.{{MLGruOptions/direction}} is not one of {{MLRecurrentNetworkDirection}}, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If |options|.{{MLGruOptions/direction}} is not one of {{MLRecurrentNetworkDirection}}, then [=exception/throw=] a {{TypeError}} and stop. 1. If |options|.{{MLGruOptions/layout}} is `undefined`, set it to `"zrn"`. - 1. If |options|.{{MLGruOptions/layout}} is not one of {{MLGruWeightLayout}}, then throw a "{{TypeError}}" {{DOMException}} and stop. - 1. If |options|.{{MLGruOptions/activations}} [=map/exists=] and is not an array of {{MLActivation}} objects with size `2`, then throw a "{{TypeError}}" {{DOMException}} and stop. - 1. If |steps| is not a [=number=] or it is `0`, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If |options|.{{MLGruOptions/layout}} is not one of {{MLGruWeightLayout}}, then [=exception/throw=] a {{TypeError}} and stop. + 1. If |options|.{{MLGruOptions/activations}} [=map/exists=] and is not an array of {{MLActivation}} objects with size `2`, then [=exception/throw=] a {{TypeError}} and stop. + 1. If |steps| is not a [=number=] or it is `0`, then [=exception/throw=] a {{TypeError}} and stop. 1. Let |output| be an empty sequence of {{MLOperand}} objects. 1. If any of the following sub-steps fail, throw an "{{OperationError}}" {{DOMException}} and stop. 1. Make a request to the underlying platform to: @@ -3064,8 +3063,8 @@ partial interface MLGraphBuilder { 1. If its rank is not `1`, then throw a "{{DataError}}" {{DOMException}} and stop. 1. If |options|.{{MLGruOptions/resetAfter}} is `undefined`, set it to `true`. 1. If |options|.{{MLGruOptions/layout}} is `undefined`, set it to `"zrn"`. - 1. If |options|.{{MLGruOptions/layout}} is not one of {{MLGruWeightLayout}}, then throw a "{{TypeError}}" {{DOMException}} and stop. - 1. If |options|.{{MLGruOptions/activations}} [=map/exists=] and is not an array of {{MLActivation}} objects with size `2`, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If |options|.{{MLGruOptions/layout}} is not one of {{MLGruWeightLayout}}, then [=exception/throw=] a {{TypeError}} and stop. + 1. If |options|.{{MLGruOptions/activations}} [=map/exists=] and is not an array of {{MLActivation}} objects with size `2`, then [=exception/throw=] a {{TypeError}} and stop. 1. Let |desc| a new {{MLOperandDescriptor}}. 1. Set |desc|.{{MLOperandDescriptor/dimensions}} to [ |input|.{{MLOperandDescriptor/dimensions}}[0], |hiddenSize| ]. 1. Set |desc|.{{MLOperandDescriptor/type}} to |input|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/type}}. @@ -3256,7 +3255,7 @@ partial interface MLGraphBuilder { The {{MLGraphBuilder/hardSigmoid(input, options)}} method steps are: 1. Let |input| be the first argument. 1. Let |options| be the second argument. - 1. If running the check hard-sigmoid options steps with |options| returns `false`, then throw a "{{TypeError}}" {{DOMException}} and abort these steps. + 1. If running the check hard-sigmoid options steps with |options| returns `false`, then [=exception/throw=] a {{TypeError}} and abort these steps. 1. If any of the following sub-steps fail, throw an "{{OperationError}}" {{DOMException}} and stop. 1. Let |output| be the result of invoking the copy MLOperand steps given |input|. 1. Make a request to the underlying platform to: @@ -3284,7 +3283,7 @@ partial interface MLGraphBuilder {
1. Let |options| be the first argument. - 1. If running the check hard-sigmoid options steps with |options| returns `false`, then throw a "{{TypeError}}" {{DOMException}} and abort these steps. + 1. If running the check hard-sigmoid options steps with |options| returns `false`, then [=exception/throw=] a {{TypeError}} and abort these steps. 1. Let |op| be the result of invoking the create MLActivation steps with `"hardSigmoid"` and |options|. 1. If that throws an error, re-throw the error and abort these steps. 1. Return |op|. @@ -3548,7 +3547,7 @@ partial interface MLGraphBuilder { 1. Let |input| be the first argument. 1. Let |options| be the second argument. 1. If |options| is `undefined`, let |options| be a new {{MLLeakyReluOptions}} object. - 1. If running the check leaky-relu options steps with |options| returns `false`, then throw a "{{TypeError}}" {{DOMException}} and abort these steps. + 1. If running the check leaky-relu options steps with |options| returns `false`, then [=exception/throw=] a {{TypeError}} and abort these steps. 1. If any of the following sub-steps fail, throw an "{{OperationError}}" {{DOMException}} and stop. 1. Let |output| be the result of invoking the copy MLOperand steps given |input|. 1. Make a request to the underlying platform to: @@ -3578,7 +3577,7 @@ partial interface MLGraphBuilder {
1. Let |options| be the first argument. 1. If |options| is `undefined`, let |options| be a new {{MLLeakyReluOptions}} object. - 1. If running the check leaky-relu options steps with |options| returns `false`, then throw a "{{TypeError}}" {{DOMException}} and abort these steps. + 1. If running the check leaky-relu options steps with |options| returns `false`, then [=exception/throw=] a {{TypeError}} and abort these steps. 1. Let |op| be the result of invoking the create MLActivation steps with `"leakyRelu"` and |options|. 1. If that throws an error, re-throw the error and abort these steps. 1. Return |op|. @@ -3659,7 +3658,7 @@ partial interface MLGraphBuilder {
1. Let |input| be the first argument. 1. Let |options| be the second argument. - 1. If running the check linear options steps with |options| returns `false`, then throw a "{{TypeError}}" {{DOMException}} and abort these steps. + 1. If running the check linear options steps with |options| returns `false`, then [=exception/throw=] a {{TypeError}} and abort these steps. 1. If any of the following sub-steps fail, throw an "{{OperationError}}" {{DOMException}} and stop. 1. Let |output| be the result of invoking the copy MLOperand steps given |input|. 1. Make a request to the underlying platform to: @@ -3688,7 +3687,7 @@ partial interface MLGraphBuilder {
1. Let |options| be the first argument. - 1. If running the check linear options steps with |options| returns `false`, then throw a "{{TypeError}}" {{DOMException}} and abort these steps. + 1. If running the check linear options steps with |options| returns `false`, then [=exception/throw=] a {{TypeError}} and abort these steps. 1. Let |op| be the result of invoking the create MLActivation steps with `"linear"` and |options|. 1. If that throws an error, re-throw the error and abort these steps. 1. Return |op|. @@ -3781,7 +3780,7 @@ partial interface MLGraphBuilder {
1. If |options| is `undefined`, let |options| be an empty [=object=]. 1. If |options|.{{MLLstmOptions/direction}} is `undefined`, set it to `"forward"`. - 1. If |options|.{{MLLstmOptions/direction}} is not one of {{MLRecurrentNetworkDirection}}, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If |options|.{{MLLstmOptions/direction}} is not one of {{MLRecurrentNetworkDirection}}, then [=exception/throw=] a {{TypeError}} and stop. 1. Let |num_directions| be `1` if |options|.{{MLLstmOptions/direction}} is `"forward"`, or otherwise let it be `2`. 1. [=Assert=]: the type of |input|, |weight| and |recurrentWeight| is {{MLOperand}}.
@@ -3818,9 +3817,9 @@ partial interface MLGraphBuilder { 1. If |options|.{{MLLstmOptions/initialCellState}}.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}}[2] is not |hiddenSize|, then throw a "{{DataError}}" {{DOMException}} and stop. 1. If |options|.{{MLLstmOptions/returnSequence}} is `undefined`, set it to `false`. 1. If |options|.{{MLLstmOptions/layout}} is `undefined`, set it to `"iofg"`. - 1. If |options|.{{MLLstmOptions/layout}} is not one of {{MLLstmWeightLayout}}, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If |options|.{{MLLstmOptions/layout}} is not one of {{MLLstmWeightLayout}}, then [=exception/throw=] a {{TypeError}} and stop. 1. If |options|.{{MLLstmOptions/activations}} [=map/exists=]: - 1. If it is not an array of size `3`, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If it is not an array of size `3`, then [=exception/throw=] a {{TypeError}} and stop. 1. [=Assert=]: the type of its elements is {{MLActivation}}. 1. If any of the following sub-steps fail, throw an "{{OperationError}}" {{DOMException}} and stop. 1. Let |desc| a new {{MLOperandDescriptor}}. @@ -4000,9 +3999,9 @@ partial interface MLGraphBuilder { 1. If its rank is not `1`, then throw a "{{DataError}}" {{DOMException}} and stop. 1. If |options|.{{MLLstmCellOptions/peepholeWeight}}.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}}[0] is not 3 * |hiddenSize|, then throw a "{{DataError}}" {{DOMException}} and stop. 1. If |options|.{{MLLstmCellOptions/layout}} is `undefined`, set it to `"iofg"`. - 1. If |options|.{{MLLstmCellOptions/layout}} is not one of {{MLLstmWeightLayout}}, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If |options|.{{MLLstmCellOptions/layout}} is not one of {{MLLstmWeightLayout}}, then [=exception/throw=] a {{TypeError}} and stop. 1. If |options|.{{MLLstmCellOptions/activations}} [=map/exists=]: - 1. If it is not an array of size `3`, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If it is not an array of size `3`, then [=exception/throw=] a {{TypeError}} and stop. 1. [=Assert=]: the type of its elements is {{MLActivation}}. 1. Let |desc| a new {{MLOperandDescriptor}}. 1. Set |desc|.{{MLOperandDescriptor/dimensions}} to [ |batch_size|, |hiddenSize| ]. @@ -4273,10 +4272,10 @@ partial interface MLGraphBuilder {
1. [=Assert=]: the type of |input| is {{MLOperand}}. - 1. If |beginningPadding| or |endingPadding| is not a sequence of {{unsigned long}}, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If |beginningPadding| or |endingPadding| is not a sequence of {{unsigned long}}, then [=exception/throw=] a {{TypeError}} and stop. 1. If |options| is `undefined`, let |options| be an empty [=object=]. 1. If |options|.{{MLPadOptions/mode}} is `undefined`, set it to `"constant"`. - 1. Otherwise, if |options|.{{MLPadOptions/mode}} is not one of {{MLPaddingMode}}, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. Otherwise, if |options|.{{MLPadOptions/mode}} is not one of {{MLPaddingMode}}, then [=exception/throw=] a {{TypeError}} and stop. 1. If |options|.{{MLPadOptions/value}} is `undefined`, set it to `0`. 1. Let |desc| be a copy of |input|.{{MLOperand/[[descriptor]]}}. 1. Set |desc|.{{MLOperandDescriptor/dimensions}} to the result of invoking the calculate padding output sizes given |input|, |beginningPadding| and |endingPadding|. @@ -5025,8 +5024,8 @@ partial interface MLGraphBuilder {
1. [=Assert=]: the type of |input| is {{MLOperand}}. - 1. If |starts| or |sizes| is not a sequence of {{long}}, then throw a "{{TypeError}}" {{DOMException}} and stop. - 1. If |sizes|.size is 0, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If |starts| or |sizes| is not a sequence of {{long}}, then [=exception/throw=] a {{TypeError}} and stop. + 1. If |sizes|.size is 0, then [=exception/throw=] a {{TypeError}} and stop.
Further validation of |starts| and |sizes| given |input| is left [=implementation-defined=].
@@ -5191,7 +5190,7 @@ partial interface MLGraphBuilder {
1. Let |input| be the first argument. 1. Let |options| be the second argument. - 1. If running the check softplus options steps with |options| returns `false`, then throw a "{{TypeError}}" {{DOMException}} and abort these steps. + 1. If running the check softplus options steps with |options| returns `false`, then [=exception/throw=] a {{TypeError}} and abort these steps. 1. If any of the following sub-steps fail, throw an "{{OperationError}}" {{DOMException}} and stop. 1. Let |output| be the result of invoking the copy MLOperand steps given |input|. 1. Make a request to the underlying platform to: @@ -5220,7 +5219,7 @@ partial interface MLGraphBuilder {
1. Let |options| be the first argument. - 1. If running the check softplus options steps with |options| returns `false`, then throw a "{{TypeError}}" {{DOMException}} and abort these steps. + 1. If running the check softplus options steps with |options| returns `false`, then [=exception/throw=] a {{TypeError}} and abort these steps. 1. Let |op| be the result of invoking the create MLActivation steps with `"softplus"` and |options|. 1. If that throws an error, re-throw the error and abort these steps. 1. Return |op|. @@ -5336,7 +5335,7 @@ partial interface MLGraphBuilder { 1. [=Assert=]: the type of |input| is {{MLOperand}}. 1. If |options| is `undefined`, let |options| be an empty [=object=]. 1. If |options|.{{MLSplitOptions/axis}} is `undefined`, let |options|.{{MLSplitOptions/axis}} be `0`. - 1. If |splits| is not {{unsigned long}} or a sequence of {{unsigned long}}, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If |splits| is not {{unsigned long}} or a sequence of {{unsigned long}}, then [=exception/throw=] a {{TypeError}} and stop. 1. If any of the following sub-steps fail, throw an "{{OperationError}}" {{DOMException}} and stop. 1. Let |output| be the result of invoking the copy MLOperand steps given |input|. 1. Make a request to the underlying platform to: @@ -5415,7 +5414,7 @@ partial interface MLGraphBuilder { 1. Let |dimensions| be |input|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}}. 1. For |index| between 0 and the size of |options|.{{MLSqueezeOptions/axes}}: 1. Let |oneDimIndex| be |options|.{{MLSqueezeOptions/axes}}[|index|]. - 1. If |dimensions|[|oneDimIndex|] is not `1`, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If |dimensions|[|oneDimIndex|] is not `1`, then [=exception/throw=] a {{TypeError}} and stop. 1. If any of the following sub-steps fail, throw an "{{OperationError}}" {{DOMException}} and stop. 1. Let |output| be the result of invoking the copy MLOperand steps given |input|. 1. Make a request to the underlying platform to: @@ -5541,10 +5540,10 @@ partial interface MLGraphBuilder { 1. If |options| is `undefined`, let |options| be an empty [=object=]. 1. If |options|.{{MLTransposeOptions/permutation}} is `undefined`, let |options|.{{MLTransposeOptions/permutation}} be the reversed sequence of all indices for |input|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}}. 1. Otherwise if |options|.{{MLTransposeOptions/permutation}} [=map/exists=]: - 1. If |options|.{{MLTransposeOptions/permutation}} is not a sequence of {{unsigned long}}, then throw a "{{TypeError}}" {{DOMException}} and stop. - 1. If the rank of |options|.{{MLTransposeOptions/permutation}} is not the same as the rank of |input|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}}, then throw a "{{TypeError}}" {{DOMException}} and stop. - 1. If the values in |options|.{{MLTransposeOptions/permutation}} are not between `0` and the rank of |input|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}} minus `1`, then throw a "{{TypeError}}" {{DOMException}} and stop. - 1. If the values in |options|.{{MLTransposeOptions/permutation}} contain duplicate value, then throw a "{{TypeError}}" {{DOMException}} and stop. + 1. If |options|.{{MLTransposeOptions/permutation}} is not a sequence of {{unsigned long}}, then [=exception/throw=] a {{TypeError}} and stop. + 1. If the rank of |options|.{{MLTransposeOptions/permutation}} is not the same as the rank of |input|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}}, then [=exception/throw=] a {{TypeError}} and stop. + 1. If the values in |options|.{{MLTransposeOptions/permutation}} are not between `0` and the rank of |input|.{{MLOperand/[[descriptor]]}}.{{MLOperandDescriptor/dimensions}} minus `1`, then [=exception/throw=] a {{TypeError}} and stop. + 1. If the values in |options|.{{MLTransposeOptions/permutation}} contain duplicate value, then [=exception/throw=] a {{TypeError}} and stop. 1. If any of the following sub-steps fail, throw an "{{OperationError}}" {{DOMException}} and stop. 1. Let |output| be the result of invoking the copy MLOperand steps given |input|. 1. Make a request to the underlying platform to: