+
**Arguments:**
- input: an {{MLOperand}}. The condition tensor.
- - scale: an {{MLOperand}}. !!!
- - zeroPoint: an {{MLOperand}}. !!!
+ - scale: an {{MLOperand}}. The scale tensor to multiply each input value by after adjusting by the zero point.
+ - zeroPoint: an {{MLOperand}}. The zero point tensor to subtract from each input value.
- options: an {{MLOperatorOptions}}. Specifies the optional parameters of the operation.
- **Returns:** an {{MLOperand}}. The output tensor that contains the values selected element-wise from ------.
+ **Returns:** an {{MLOperand}}. The output tensor that contains the values computed from the quantization.
{{MLQuantizationSupportLimits}} has the following members:
@@ -3830,24 +3806,11 @@ partial dictionary MLOpSupportLimits {
- The quantizeLinear(|input|, |scale|, |zeroPoint|, |options|) method steps are:
+ The where(|input|, |scale|, |zeroPoint|, |options|) method steps are:
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 |condition|'s [=MLOperand/dataType=] is not equal to {{MLOperandDataType/"uint8"}}, then [=exception/throw=] a {{TypeError}}.
- 1. If |trueValue|'s [=MLOperand/dataType=] is not equal to |falseValue|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}.
- 1. Let |outputShape| be the result of [=bidirectionally broadcasting=] |trueValue|'s [=MLOperand/shape=] and |falseValue|'s [=MLOperand/shape=].
- 1. If that returns failure, then [=exception/throw=] a {{TypeError}}.
- 1. Set |outputShape| to the result of [=bidirectionally broadcasting=] |condition|'s [=MLOperand/shape=] and |outputShape].
- 1. If that returns failure, then [=exception/throw=] a {{TypeError}}.
- 1. Let |descriptor| be the result of [=creating an MLOperandDescriptor=] given |trueValue|'s [=MLOperand/dataType=] and |outputShape|.
- 1. *Make graph connections:*
- 1. Let |output| be the result of [=creating an MLOperand=] given [=this=] and |descriptor|.
- 1. Let |operator| be an [=operator=] for the "where" operation, given |condition|, |trueValue|, |falseValue|, and |options|.
- 1. Set |output|.{{MLOperand/[[operator]]}} to |operator|.
- 1. Set |operator|'s [=operator/inputs=] to |condition|, |trueValue| and |falseValue|.
- 1. Set |operator|'s [=operator/output=] to |output|.
- 1. Return |output|.
+ 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |scale|, and |zeroPoint| returns false, then [=exception/throw=] a {{TypeError}}.
+ TODO: Add validation for scale and zero point shape.
@@ -3856,14 +3819,7 @@ partial dictionary MLOpSupportLimits {
The behavior of this operation can be [EMULATED]
- ------
- function where(builder, condition, trueValue, falseValue) {
- const c = builder.clamp(condition, {'minValue': 0, 'maxValue': 1});
- builder.add(
- builder.mul(trueValue, builder.cast(c, trueValue.dataType)),
- builder.mul(
- falseValue, builder.cast(builder.logicalNot(c), falseValue.dataType)));
- }
+ TODO:
@@ -4214,7 +4170,6 @@ partial dictionary MLOpSupportLimits {
### gatherElements ### {#api-mlgraphbuilder-gatherelements}
-!!!
Gather values of the input tensor along an axis according to the indices.
{{MLLayerNormalizationOptions}} has the following members:
-