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

Fix input names for quantize/dequantize ONNX backend tests #6122

Merged
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/Operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -7700,7 +7700,7 @@ node = onnx.helper.make_node(
# scalar zero point and scale
x = make_tensor("x", TensorProto.INT4, [5], [0, 1, 7, -4, -8])
x_scale = np.float32(2)
x_zero_point = make_tensor("zero_point", TensorProto.INT4, (1,), [1])
x_zero_point = make_tensor("x_zero_point", TensorProto.INT4, (1,), [1])
y = np.array([-2, 0, 12, -10, -18], dtype=np.float32)

expect(
Expand Down Expand Up @@ -7754,7 +7754,7 @@ node = onnx.helper.make_node(
# scalar zero point and scale
x = make_tensor("x", TensorProto.UINT4, [5], [0, 1, 7, 10, 15])
x_scale = np.float32(2)
x_zero_point = make_tensor("zero_point", TensorProto.UINT4, (1,), [1])
x_zero_point = make_tensor("x_zero_point", TensorProto.UINT4, (1,), [1])
y = np.array([-2, 0, 12, 18, 28], dtype=np.float32)

expect(
Expand Down Expand Up @@ -20532,7 +20532,7 @@ node = onnx.helper.make_node(

x = np.array([0.0, 1.0, 2.0, 100000.0, 200.0]).astype(np.float32)
y_scale = np.float32(2)
y_zero_point = make_tensor("zero_point", TensorProto.FLOAT8E4M3FN, [1], [0])
y_zero_point = make_tensor("y_zero_point", TensorProto.FLOAT8E4M3FN, [1], [0])
y = make_tensor("y", TensorProto.FLOAT8E4M3FN, [5], [0, 0.5, 1, 448, 96])

expect(
Expand All @@ -20558,7 +20558,7 @@ node = onnx.helper.make_node(

x = np.array([0.0, 1.0, 2.0, 100000.0, 200.0]).astype(np.float32)
y_scale = np.float32(2)
y_zero_point = make_tensor("zero_point", TensorProto.FLOAT8E5M2, [1], [0.0])
y_zero_point = make_tensor("y_zero_point", TensorProto.FLOAT8E5M2, [1], [0.0])
y = make_tensor("y", TensorProto.FLOAT8E5M2, [5], [0, 0.5, 1, 49152, 96])

expect(
Expand Down Expand Up @@ -20657,7 +20657,7 @@ x = np.array(

y_scale = np.asarray([2.0, 3.0, 4.0], dtype=np.float32)
y_zero_point = make_tensor(
"zero_point", TensorProto.INT4, y_scale.shape, np.ones_like(y_scale)
"y_zero_point", TensorProto.INT4, y_scale.shape, np.ones_like(y_scale)
)
y = make_tensor(
"y", TensorProto.INT4, x.shape, [1, 2, 3, 5, -8, -6, 3, 4, 4, 5, 5, 7]
Expand Down Expand Up @@ -20777,7 +20777,7 @@ x = np.array(

y_scale = np.asarray([2.0, 3.0, 4.0], dtype=np.float32)
y_zero_point = make_tensor(
"zero_point", TensorProto.UINT4, y_scale.shape, np.ones_like(y_scale)
"y_zero_point", TensorProto.UINT4, y_scale.shape, np.ones_like(y_scale)
)
y = make_tensor(
"y", TensorProto.UINT4, x.shape, [1, 2, 3, 5, -1, -1, 3, 4, 4, 5, 5, 11]
Expand Down
12 changes: 6 additions & 6 deletions docs/TestCoverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -5449,7 +5449,7 @@ node = onnx.helper.make_node(
# scalar zero point and scale
x = make_tensor("x", TensorProto.INT4, [5], [0, 1, 7, -4, -8])
x_scale = np.float32(2)
x_zero_point = make_tensor("zero_point", TensorProto.INT4, (1,), [1])
x_zero_point = make_tensor("x_zero_point", TensorProto.INT4, (1,), [1])
y = np.array([-2, 0, 12, -10, -18], dtype=np.float32)

expect(
Expand Down Expand Up @@ -5499,7 +5499,7 @@ node = onnx.helper.make_node(
# scalar zero point and scale
x = make_tensor("x", TensorProto.UINT4, [5], [0, 1, 7, 10, 15])
x_scale = np.float32(2)
x_zero_point = make_tensor("zero_point", TensorProto.UINT4, (1,), [1])
x_zero_point = make_tensor("x_zero_point", TensorProto.UINT4, (1,), [1])
y = np.array([-2, 0, 12, 18, 28], dtype=np.float32)

expect(
Expand Down Expand Up @@ -13955,7 +13955,7 @@ node = onnx.helper.make_node(

x = np.array([0.0, 1.0, 2.0, 100000.0, 200.0]).astype(np.float32)
y_scale = np.float32(2)
y_zero_point = make_tensor("zero_point", TensorProto.FLOAT8E4M3FN, [1], [0])
y_zero_point = make_tensor("y_zero_point", TensorProto.FLOAT8E4M3FN, [1], [0])
y = make_tensor("y", TensorProto.FLOAT8E4M3FN, [5], [0, 0.5, 1, 448, 96])

expect(
Expand All @@ -13979,7 +13979,7 @@ node = onnx.helper.make_node(

x = np.array([0.0, 1.0, 2.0, 100000.0, 200.0]).astype(np.float32)
y_scale = np.float32(2)
y_zero_point = make_tensor("zero_point", TensorProto.FLOAT8E5M2, [1], [0.0])
y_zero_point = make_tensor("y_zero_point", TensorProto.FLOAT8E5M2, [1], [0.0])
y = make_tensor("y", TensorProto.FLOAT8E5M2, [5], [0, 0.5, 1, 49152, 96])

expect(
Expand Down Expand Up @@ -14074,7 +14074,7 @@ x = np.array(

y_scale = np.asarray([2.0, 3.0, 4.0], dtype=np.float32)
y_zero_point = make_tensor(
"zero_point", TensorProto.INT4, y_scale.shape, np.ones_like(y_scale)
"y_zero_point", TensorProto.INT4, y_scale.shape, np.ones_like(y_scale)
)
y = make_tensor(
"y", TensorProto.INT4, x.shape, [1, 2, 3, 5, -8, -6, 3, 4, 4, 5, 5, 7]
Expand Down Expand Up @@ -14188,7 +14188,7 @@ x = np.array(

y_scale = np.asarray([2.0, 3.0, 4.0], dtype=np.float32)
y_zero_point = make_tensor(
"zero_point", TensorProto.UINT4, y_scale.shape, np.ones_like(y_scale)
"y_zero_point", TensorProto.UINT4, y_scale.shape, np.ones_like(y_scale)
)
y = make_tensor(
"y", TensorProto.UINT4, x.shape, [1, 2, 3, 5, -1, -1, 3, 4, 4, 5, 5, 11]
Expand Down
4 changes: 2 additions & 2 deletions onnx/backend/test/case/node/dequantizelinear.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
# scalar zero point and scale
x = make_tensor("x", TensorProto.UINT4, [5], [0, 1, 7, 10, 15])
x_scale = np.float32(2)
x_zero_point = make_tensor("zero_point", TensorProto.UINT4, (1,), [1])
x_zero_point = make_tensor("x_zero_point", TensorProto.UINT4, (1,), [1])

Check warning on line 206 in onnx/backend/test/case/node/dequantizelinear.py

View check run for this annotation

Codecov / codecov/patch

onnx/backend/test/case/node/dequantizelinear.py#L206

Added line #L206 was not covered by tests
y = np.array([-2, 0, 12, 18, 28], dtype=np.float32)

expect(
Expand All @@ -225,7 +225,7 @@
# scalar zero point and scale
x = make_tensor("x", TensorProto.INT4, [5], [0, 1, 7, -4, -8])
x_scale = np.float32(2)
x_zero_point = make_tensor("zero_point", TensorProto.INT4, (1,), [1])
x_zero_point = make_tensor("x_zero_point", TensorProto.INT4, (1,), [1])

Check warning on line 228 in onnx/backend/test/case/node/dequantizelinear.py

View check run for this annotation

Codecov / codecov/patch

onnx/backend/test/case/node/dequantizelinear.py#L228

Added line #L228 was not covered by tests
y = np.array([-2, 0, 12, -10, -18], dtype=np.float32)

expect(
Expand Down
8 changes: 4 additions & 4 deletions onnx/backend/test/case/node/quantizelinear.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

x = np.array([0.0, 1.0, 2.0, 100000.0, 200.0]).astype(np.float32)
y_scale = np.float32(2)
y_zero_point = make_tensor("zero_point", TensorProto.FLOAT8E4M3FN, [1], [0])
y_zero_point = make_tensor("y_zero_point", TensorProto.FLOAT8E4M3FN, [1], [0])

Check warning on line 77 in onnx/backend/test/case/node/quantizelinear.py

View check run for this annotation

Codecov / codecov/patch

onnx/backend/test/case/node/quantizelinear.py#L77

Added line #L77 was not covered by tests
y = make_tensor("y", TensorProto.FLOAT8E4M3FN, [5], [0, 0.5, 1, 448, 96])

expect(
Expand All @@ -94,7 +94,7 @@

x = np.array([0.0, 1.0, 2.0, 100000.0, 200.0]).astype(np.float32)
y_scale = np.float32(2)
y_zero_point = make_tensor("zero_point", TensorProto.FLOAT8E5M2, [1], [0.0])
y_zero_point = make_tensor("y_zero_point", TensorProto.FLOAT8E5M2, [1], [0.0])

Check warning on line 97 in onnx/backend/test/case/node/quantizelinear.py

View check run for this annotation

Codecov / codecov/patch

onnx/backend/test/case/node/quantizelinear.py#L97

Added line #L97 was not covered by tests
y = make_tensor("y", TensorProto.FLOAT8E5M2, [5], [0, 0.5, 1, 49152, 96])

expect(
Expand Down Expand Up @@ -231,7 +231,7 @@

y_scale = np.asarray([2.0, 3.0, 4.0], dtype=np.float32)
y_zero_point = make_tensor(
"zero_point", TensorProto.UINT4, y_scale.shape, np.ones_like(y_scale)
"y_zero_point", TensorProto.UINT4, y_scale.shape, np.ones_like(y_scale)
)
y = make_tensor(
"y", TensorProto.UINT4, x.shape, [1, 2, 3, 5, -1, -1, 3, 4, 4, 5, 5, 11]
Expand Down Expand Up @@ -263,7 +263,7 @@

y_scale = np.asarray([2.0, 3.0, 4.0], dtype=np.float32)
y_zero_point = make_tensor(
"zero_point", TensorProto.INT4, y_scale.shape, np.ones_like(y_scale)
"y_zero_point", TensorProto.INT4, y_scale.shape, np.ones_like(y_scale)
)
y = make_tensor(
"y", TensorProto.INT4, x.shape, [1, 2, 3, 5, -8, -6, 3, 4, 4, 5, 5, 7]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
*B
zero_point
*B x_zero_point
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
*B
zero_point
*B x_zero_point
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
*B
zero_point
*B y_zero_point
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
*B
zero_point
*B y_zero_point
Loading