Skip to content

Commit

Permalink
Fix none value for out_dtype in quantized_decomposed_dequantize_per_t…
Browse files Browse the repository at this point in the history
…ensor (#1785)

That fixes the dort unit test series.

---------

Signed-off-by: Xavier Dupre <[email protected]>
  • Loading branch information
xadupre authored Aug 7, 2024
1 parent 35a35db commit 66e6a66
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions onnxscript/backend/onnx_export_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ def skip(pattern: str | Pattern, reason: str, *, condition: bool = True):
"cannot import module, import_module does not work",
),
skip("^test_bitwise_not_3d", "cannot import module, import_module does not work"),
skip(
"^test_resize_upsample_scales_linear_half_pixel_symmetric",
"cannot import module, import_module does not work",
),
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def quantized_decomposed_dequantize_per_tensor(
) -> TensorType:
# TODO(justinchuby): Use dtype when we use opset 21
dequantized = op.DequantizeLinear(input, scale, common.constant(zero_point, dtype=dtype))
if out_dtype == -1:
if out_dtype in (-1, None):
# out_dtype can be None as well
return dequantized
assert out_dtype > 0, f"out_dtype must be -1 or > 0 not {out_dtype}"
return op.Cast(dequantized, to=out_dtype)

0 comments on commit 66e6a66

Please sign in to comment.