From b099a24822e334cf339eadb72e06eef3ab9d2f1b Mon Sep 17 00:00:00 2001 From: Tom Wildenhain Date: Tue, 15 Dec 2020 16:17:10 -0500 Subject: [PATCH] Fix quant and dequant for opset 13 Signed-off-by: Tom Wildenhain --- tf2onnx/rewriter/quantization_ops_rewriter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tf2onnx/rewriter/quantization_ops_rewriter.py b/tf2onnx/rewriter/quantization_ops_rewriter.py index 59c512396..ec0a1d840 100644 --- a/tf2onnx/rewriter/quantization_ops_rewriter.py +++ b/tf2onnx/rewriter/quantization_ops_rewriter.py @@ -64,7 +64,8 @@ def create_qdq_nodes(g, match_results): zero_point = zero_point[0] attrs = {} else: - utils.make_sure(axis, "Axis must be specified for per channel quantization") + utils.make_sure(axis and axis != -1, "Axis must be specified for per channel quantization") + utils.make_sure(g.opset >= 13, "Opset >= 13 is required for per channel quantization") attrs = {'axis': axis} # Split it into QuantizeLinear and DequantizeLinear and remove the QDQ node reference