From 3eec3a4bc7dcf4ebb127fd332fd134567d563cc6 Mon Sep 17 00:00:00 2001 From: BruceDai Date: Tue, 25 Nov 2025 14:48:37 +0800 Subject: [PATCH 1/6] Restrict scale of dequantizeLinear and quantizeLinear to be positive --- index.bs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index ea00ea42..d317b3bb 100644 --- a/index.bs +++ b/index.bs @@ -4106,7 +4106,7 @@ partial dictionary MLOpSupportLimits {
**Arguments:** - input: an {{MLOperand}}. The input tensor. - - scale: an {{MLOperand}}. The scale tensor to multiply each input value by after adjusting by the zero point. It must be [=blockwise broadcastable=] with the input. + - scale: an {{MLOperand}}. The scale tensor to multiply each input value by after adjusting by the zero point. It must be [=blockwise broadcastable=] with the input. It must be positive. - zeroPoint: an {{MLOperand}}. The zero point tensor to subtract from each input value. It has the same [=MLOperand/shape=] as the scale. - options: an {{MLOperatorOptions}}. Specifies the optional parameters of the operation. @@ -4170,6 +4170,7 @@ partial dictionary MLOpSupportLimits { 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |scale|, and |zeroPoint| returns false, then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-dequantizelinear)), then [=exception/throw=] a {{TypeError}}. 1. If |scale|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-dequantizelinear)), then [=exception/throw=] a {{TypeError}}. + 1. If |scale|'s values contain non-positive values, then [=exception/throw=] a {{TypeError}}. 1. If |zeroPoint|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-dequantizelinear)), then [=exception/throw=] a {{TypeError}}. 1. If |scale|'s [=MLOperand/rank=] or |zeroPoint|'s [=MLOperand/rank=] is not equal to |input|'s [=MLOperand/rank=], then [=exception/throw=] a {{TypeError}}. 1. If |scale|'s [=MLOperand/shape=] is not [=list/equal=] to |zeroPoint|'s [=MLOperand/shape=], then [=exception/throw=] a {{TypeError}}. @@ -4280,7 +4281,7 @@ partial dictionary MLOpSupportLimits {
**Arguments:** - input: an {{MLOperand}}. The input tensor. - - scale: an {{MLOperand}}. The scale tensor to divide each input value by before adjusting by the zero point. It must be [=blockwise broadcastable=] with the input. + - scale: an {{MLOperand}}. The scale tensor to divide each input value by before adjusting by the zero point. It must be [=blockwise broadcastable=] with the input. It must be positive. - zeroPoint: an {{MLOperand}}. The zero point tensor to add to each rescaled input value. It has the same [=MLOperand/shape=] as the scale. - options: an {{MLOperatorOptions}}. Specifies the optional parameters of the operation. @@ -4333,6 +4334,7 @@ partial dictionary MLOpSupportLimits { 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |scale|, and |zeroPoint| returns false, then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-quantizelinear)), then [=exception/throw=] a {{TypeError}}. 1. If |scale|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-quantizelinear)), then [=exception/throw=] a {{TypeError}}. + 1. If |scale|'s values contain non-positive values, then [=exception/throw=] a {{TypeError}}. 1. If |zeroPoint|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-quantizelinear)), then [=exception/throw=] a {{TypeError}}. 1. If |scale|'s [=MLOperand/rank=] or |zeroPoint|'s [=MLOperand/rank=] is not equal to |input|'s [=MLOperand/rank=], then [=exception/throw=] a {{TypeError}}. 1. If |scale|'s [=MLOperand/shape=] is not [=list/equal=] to |zeroPoint|'s [=MLOperand/shape=], then [=exception/throw=] a {{TypeError}}. From f561134bbc3ffa42f33f68f042c8b3bc993aa4cb Mon Sep 17 00:00:00 2001 From: BruceDai Date: Wed, 26 Nov 2025 09:28:39 +0800 Subject: [PATCH 2/6] Update description for non-positive scale values --- index.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index d317b3bb..325d6808 100644 --- a/index.bs +++ b/index.bs @@ -4170,7 +4170,7 @@ partial dictionary MLOpSupportLimits { 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |scale|, and |zeroPoint| returns false, then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-dequantizelinear)), then [=exception/throw=] a {{TypeError}}. 1. If |scale|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-dequantizelinear)), then [=exception/throw=] a {{TypeError}}. - 1. If |scale|'s values contain non-positive values, then [=exception/throw=] a {{TypeError}}. + 1. If |scale|'s values contain non-positive values, they are unsupported. 1. If |zeroPoint|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-dequantizelinear)), then [=exception/throw=] a {{TypeError}}. 1. If |scale|'s [=MLOperand/rank=] or |zeroPoint|'s [=MLOperand/rank=] is not equal to |input|'s [=MLOperand/rank=], then [=exception/throw=] a {{TypeError}}. 1. If |scale|'s [=MLOperand/shape=] is not [=list/equal=] to |zeroPoint|'s [=MLOperand/shape=], then [=exception/throw=] a {{TypeError}}. @@ -4334,7 +4334,7 @@ partial dictionary MLOpSupportLimits { 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |scale|, and |zeroPoint| returns false, then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-quantizelinear)), then [=exception/throw=] a {{TypeError}}. 1. If |scale|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-quantizelinear)), then [=exception/throw=] a {{TypeError}}. - 1. If |scale|'s values contain non-positive values, then [=exception/throw=] a {{TypeError}}. + 1. If |scale|'s values contain non-positive values, they are unsupported. 1. If |zeroPoint|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-quantizelinear)), then [=exception/throw=] a {{TypeError}}. 1. If |scale|'s [=MLOperand/rank=] or |zeroPoint|'s [=MLOperand/rank=] is not equal to |input|'s [=MLOperand/rank=], then [=exception/throw=] a {{TypeError}}. 1. If |scale|'s [=MLOperand/shape=] is not [=list/equal=] to |zeroPoint|'s [=MLOperand/shape=], then [=exception/throw=] a {{TypeError}}. From 5a5280d7aaef05a6a50b2b3929aa8186769f31ce Mon Sep 17 00:00:00 2001 From: BruceDai Date: Wed, 26 Nov 2025 14:55:27 +0800 Subject: [PATCH 3/6] remove the step of checking scale contain non-positive values --- index.bs | 2 -- 1 file changed, 2 deletions(-) diff --git a/index.bs b/index.bs index 325d6808..c00febac 100644 --- a/index.bs +++ b/index.bs @@ -4170,7 +4170,6 @@ partial dictionary MLOpSupportLimits { 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |scale|, and |zeroPoint| returns false, then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-dequantizelinear)), then [=exception/throw=] a {{TypeError}}. 1. If |scale|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-dequantizelinear)), then [=exception/throw=] a {{TypeError}}. - 1. If |scale|'s values contain non-positive values, they are unsupported. 1. If |zeroPoint|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-dequantizelinear)), then [=exception/throw=] a {{TypeError}}. 1. If |scale|'s [=MLOperand/rank=] or |zeroPoint|'s [=MLOperand/rank=] is not equal to |input|'s [=MLOperand/rank=], then [=exception/throw=] a {{TypeError}}. 1. If |scale|'s [=MLOperand/shape=] is not [=list/equal=] to |zeroPoint|'s [=MLOperand/shape=], then [=exception/throw=] a {{TypeError}}. @@ -4334,7 +4333,6 @@ partial dictionary MLOpSupportLimits { 1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |scale|, and |zeroPoint| returns false, then [=exception/throw=] a {{TypeError}}. 1. If |input|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-quantizelinear)), then [=exception/throw=] a {{TypeError}}. 1. If |scale|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-quantizelinear)), then [=exception/throw=] a {{TypeError}}. - 1. If |scale|'s values contain non-positive values, they are unsupported. 1. If |zeroPoint|'s [=MLOperand/dataType=] is not one of its [=/allowed data types=] (according to [this table](#tensor-limits-quantizelinear)), then [=exception/throw=] a {{TypeError}}. 1. If |scale|'s [=MLOperand/rank=] or |zeroPoint|'s [=MLOperand/rank=] is not equal to |input|'s [=MLOperand/rank=], then [=exception/throw=] a {{TypeError}}. 1. If |scale|'s [=MLOperand/shape=] is not [=list/equal=] to |zeroPoint|'s [=MLOperand/shape=], then [=exception/throw=] a {{TypeError}}. From db19e623f0e06f0e9af2cfd1e63ad97165447e86 Mon Sep 17 00:00:00 2001 From: Dwayne Robinson Date: Wed, 26 Nov 2025 17:33:15 -0800 Subject: [PATCH 4/6] Update prose to say values must be nonzero --- index.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index c00febac..cdfbefc3 100644 --- a/index.bs +++ b/index.bs @@ -4106,7 +4106,7 @@ partial dictionary MLOpSupportLimits {
**Arguments:** - input: an {{MLOperand}}. The input tensor. - - scale: an {{MLOperand}}. The scale tensor to multiply each input value by after adjusting by the zero point. It must be [=blockwise broadcastable=] with the input. It must be positive. + - scale: an {{MLOperand}}. The scale tensor to multiply each input value by after adjusting by the zero point. It must be [=blockwise broadcastable=] with the input. Values must be positive and nonzero. - zeroPoint: an {{MLOperand}}. The zero point tensor to subtract from each input value. It has the same [=MLOperand/shape=] as the scale. - options: an {{MLOperatorOptions}}. Specifies the optional parameters of the operation. @@ -4280,7 +4280,7 @@ partial dictionary MLOpSupportLimits {
**Arguments:** - input: an {{MLOperand}}. The input tensor. - - scale: an {{MLOperand}}. The scale tensor to divide each input value by before adjusting by the zero point. It must be [=blockwise broadcastable=] with the input. It must be positive. + - scale: an {{MLOperand}}. The scale tensor to divide each input value by before adjusting by the zero point. It must be [=blockwise broadcastable=] with the input. Values must be positive and nonzero. - zeroPoint: an {{MLOperand}}. The zero point tensor to add to each rescaled input value. It has the same [=MLOperand/shape=] as the scale. - options: an {{MLOperatorOptions}}. Specifies the optional parameters of the operation. From eab66041d87532a8344165d5b3c74d99f06227c0 Mon Sep 17 00:00:00 2001 From: BruceDai Date: Fri, 16 Jan 2026 16:33:06 +0800 Subject: [PATCH 5/6] update descriptions for scale's values being negative --- index.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index cdfbefc3..2c0a2a87 100644 --- a/index.bs +++ b/index.bs @@ -4106,7 +4106,7 @@ partial dictionary MLOpSupportLimits {
**Arguments:** - input: an {{MLOperand}}. The input tensor. - - scale: an {{MLOperand}}. The scale tensor to multiply each input value by after adjusting by the zero point. It must be [=blockwise broadcastable=] with the input. Values must be positive and nonzero. + - scale: an {{MLOperand}}. The scale tensor to multiply each input value by after adjusting by the zero point. It must be [=blockwise broadcastable=] with the input. Values must be positive and nonzero, or else behaviors are implementation dependent (e.g. correct results, incorrect results, compilation failure). - zeroPoint: an {{MLOperand}}. The zero point tensor to subtract from each input value. It has the same [=MLOperand/shape=] as the scale. - options: an {{MLOperatorOptions}}. Specifies the optional parameters of the operation. @@ -4280,7 +4280,7 @@ partial dictionary MLOpSupportLimits {
**Arguments:** - input: an {{MLOperand}}. The input tensor. - - scale: an {{MLOperand}}. The scale tensor to divide each input value by before adjusting by the zero point. It must be [=blockwise broadcastable=] with the input. Values must be positive and nonzero. + - scale: an {{MLOperand}}. The scale tensor to divide each input value by before adjusting by the zero point. It must be [=blockwise broadcastable=] with the input. Values must be positive and nonzero, or else behaviors are implementation dependent (e.g. correct results, incorrect results, compilation failure). - zeroPoint: an {{MLOperand}}. The zero point tensor to add to each rescaled input value. It has the same [=MLOperand/shape=] as the scale. - options: an {{MLOperatorOptions}}. Specifies the optional parameters of the operation. From 598de1a837b8d81ddb0681623c5b8eb22c7c7bf3 Mon Sep 17 00:00:00 2001 From: BruceDai Date: Thu, 22 Jan 2026 17:15:22 +0800 Subject: [PATCH 6/6] refine descriptions for scale's values being negative --- index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.bs b/index.bs index 2c0a2a87..c401a476 100644 --- a/index.bs +++ b/index.bs @@ -4106,7 +4106,7 @@ partial dictionary MLOpSupportLimits {
**Arguments:** - input: an {{MLOperand}}. The input tensor. - - scale: an {{MLOperand}}. The scale tensor to multiply each input value by after adjusting by the zero point. It must be [=blockwise broadcastable=] with the input. Values must be positive and nonzero, or else behaviors are implementation dependent (e.g. correct results, incorrect results, compilation failure). + - scale: an {{MLOperand}}. The scale tensor to multiply each input value by after adjusting by the zero point. It must be [=blockwise broadcastable=] with the input. Values must be positive and nonzero, or else the behavior is [=implementation-defined=] (e.g. correct results, incorrect results or compilation failure). - zeroPoint: an {{MLOperand}}. The zero point tensor to subtract from each input value. It has the same [=MLOperand/shape=] as the scale. - options: an {{MLOperatorOptions}}. Specifies the optional parameters of the operation.