Skip to content

Commit

Permalink
Fix input names for quantize/dequantize onnx backend tests
Browse files Browse the repository at this point in the history
Signed-off-by: adrianlizarraga <adlizarraga@microsoft.com>
  • Loading branch information
adrianlizarraga committed May 2, 2024
1 parent 1529880 commit 53b9ac6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
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 @@ def export_uint4() -> None:
# 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 All @@ -225,7 +225,7 @@ def export_int4() -> None:
# 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
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 @@ def export_e4m3fn() -> None:

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 @@ -94,7 +94,7 @@ def export_e5m2() -> None:

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 @@ -231,7 +231,7 @@ def export_uint4() -> None:

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 @@ def export_int4() -> None:

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

0 comments on commit 53b9ac6

Please sign in to comment.