Skip to content

Commit

Permalink
Specify axis parameter for DequantizeLinear when input rank is 1
Browse files Browse the repository at this point in the history
Signed-off-by: isdanni <leedanni@gmail.com>
  • Loading branch information
isdanni committed May 6, 2024
1 parent 9f6f3a0 commit 6e1e224
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
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 @@ ONNX_OPERATOR_SET_SCHEMA(
.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

0 comments on commit 6e1e224

Please sign in to comment.