Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify axis parameter for DequantizeLinear when input rank is 1 #6095

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -22955,7 +22955,7 @@ This version of the operator has been available since version 19 of the default

<dl>
<dt><tt>axis</tt> : int (default is 1)</dt>
<dd>(Optional) The axis of the dequantizing dimension of the input tensor. Ignored for per-tensor quantization. Negative value means counting dimensions from the back. Accepted range is [-r, r-1] where r = rank(input).</dd>
<dd>(Optional) The axis of the dequantizing dimension of the input tensor. Used only for per-axis quantization. Negative value means counting dimensions from the back. Accepted range is `[-r, r-1]` where `r = rank(input)`. When the rank of the input is 1, per-tensor quantization is applied, rendering the axis unnecessary in this scenario.</dd>
</dl>

#### Inputs (2 - 3)
Expand Down Expand Up @@ -25406,7 +25406,7 @@ This version of the operator has been available since version 21 of the default

<dl>
<dt><tt>axis</tt> : int (default is 1)</dt>
<dd>(Optional) The axis of the dequantizing dimension of the input tensor. Used for per-axis and blocked quantization. Negative value means counting dimensions from the back. Accepted range is `[-r, r-1]` where `r = rank(input)`.</dd>
<dd>(Optional) The axis of the dequantizing dimension of the input tensor. Used only for per-axis and blocked quantization. Negative value means counting dimensions from the back. Accepted range is `[-r, r-1]` where `r = rank(input)`. When the rank of the input is 1, per-tensor quantization is applied, rendering the axis unnecessary in this scenario.</dd>
<dt><tt>block_size</tt> : int (default is 0)</dt>
<dd>(Optional) The size of the quantization block (number of times every scale is replicated). Used only for blocked quantization. The block size is a positive integer. Given `x` shape `(D0, ..., Di, ..., Dn)`, `y_scale` shape `(S0, ... Si, ...Sn)` and `axis=i`, the accepted range is `[ceil(Di/Si), ceil(Di/(Si-1))-1]`</dd>
<dt><tt>output_dtype</tt> : int (default is 0)</dt>
Expand Down
2 changes: 1 addition & 1 deletion docs/Operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -20309,7 +20309,7 @@ Other versions of this operator: <a href="Changelog.md#QuantizeLinear-10">10</a>

<dl>
<dt><tt>axis</tt> : int (default is 1)</dt>
<dd>(Optional) The axis of the dequantizing dimension of the input tensor. Used for per-axis and blocked quantization. Negative value means counting dimensions from the back. Accepted range is `[-r, r-1]` where `r = rank(input)`.</dd>
<dd>(Optional) The axis of the dequantizing dimension of the input tensor. Used only for per-axis and blocked quantization. Negative value means counting dimensions from the back. Accepted range is `[-r, r-1]` where `r = rank(input)`. When the rank of the input is 1, per-tensor quantization is applied, rendering the axis unnecessary in this scenario.</dd>
<dt><tt>block_size</tt> : int (default is 0)</dt>
<dd>(Optional) The size of the quantization block (number of times every scale is replicated). Used only for blocked quantization. The block size is a positive integer. Given `x` shape `(D0, ..., Di, ..., Dn)`, `y_scale` shape `(S0, ... Si, ...Sn)` and `axis=i`, the accepted range is `[ceil(Di/Si), ceil(Di/(Si-1))-1]`</dd>
<dt><tt>output_dtype</tt> : int (default is 0)</dt>
Expand Down
5 changes: 3 additions & 2 deletions onnx/defs/quantization/defs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ ONNX_OPERATOR_SET_SCHEMA(
.Output(0, "y", "N-D quantized output tensor. It has same shape as input `x`.", "T2")
.Attr(
"axis",
"(Optional) The axis of the dequantizing dimension of the input tensor. Used for per-axis and blocked "
"(Optional) The axis of the dequantizing dimension of the input tensor. Used only for per-axis and blocked "
"quantization. Negative value means counting dimensions from the back. Accepted range is `[-r, r-1]` "
"where `r = rank(input)`.",
"where `r = rank(input)`. When the rank of the input is 1, per-tensor quantization is applied, "
"rendering the axis unnecessary in this scenario.",
AttributeProto::INT,
static_cast<int64_t>(1))
.Attr(
Expand Down
5 changes: 4 additions & 1 deletion onnx/defs/quantization/old.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@
.Output(0, "y", "N-D full precision output tensor. It has same shape as input 'x'.", "T2")
.Attr(
"axis",
"(Optional) The axis of the dequantizing dimension of the input tensor. Ignored for per-tensor quantization. Negative value means counting dimensions from the back. Accepted range is [-r, r-1] where r = rank(input).",
"(Optional) The axis of the dequantizing dimension of the input tensor. Used only for per-axis quantization. "

Check warning on line 113 in onnx/defs/quantization/old.cc

View workflow job for this annotation

GitHub Actions / Optional Lint

[cpplint] reported by reviewdog 🐶 Lines should be <= 120 characters long [whitespace/line_length] [2] Raw Output: onnx/defs/quantization/old.cc:113: Lines should be <= 120 characters long [whitespace/line_length] [2]
"Negative value means counting dimensions from the back. Accepted range is `[-r, r-1]` "
"where `r = rank(input)`. When the rank of the input is 1, per-tensor quantization is applied, "
"rendering the axis unnecessary in this scenario.",
AttributeProto::INT,
static_cast<int64_t>(1))
.TypeConstraint(
Expand Down