From 47066a349976b122cf695e7247de7124809f1373 Mon Sep 17 00:00:00 2001 From: wjj19950828 Date: Fri, 22 Jul 2022 11:32:22 +0800 Subject: [PATCH] fixed for ci --- x2paddle/op_mapper/onnx2paddle/onnx_op_mapper.py | 2 +- x2paddle/op_mapper/onnx2paddle/opset/opset.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/x2paddle/op_mapper/onnx2paddle/onnx_op_mapper.py b/x2paddle/op_mapper/onnx2paddle/onnx_op_mapper.py index 7a0ec49..28ff1d3 100644 --- a/x2paddle/op_mapper/onnx2paddle/onnx_op_mapper.py +++ b/x2paddle/op_mapper/onnx2paddle/onnx_op_mapper.py @@ -84,7 +84,7 @@ class ONNXOpMapper(): else: break opset = 'OpSet' + str(run_op_set) - print('Now, onnx2paddle support convert onnx model opset_verison {},' + print('Now, onnx2paddle support convert onnx model opset_verison {}, ' 'opset_verison of your onnx model is {}.' .format(self.support_op_sets, decoder.op_set)) return eval(opset)(decoder, self.paddle_graph) diff --git a/x2paddle/op_mapper/onnx2paddle/opset/opset.py b/x2paddle/op_mapper/onnx2paddle/opset/opset.py index ac3035a..808dd39 100755 --- a/x2paddle/op_mapper/onnx2paddle/opset/opset.py +++ b/x2paddle/op_mapper/onnx2paddle/opset/opset.py @@ -28,7 +28,7 @@ import copy import sys import shutil -_logger = _logging.getLogger(__name__) +_logger = _logging.getLogger() def _const_weight_or_none(node, necessary=False): @@ -2203,8 +2203,12 @@ class OpSet(): paddings = np.array(pads).reshape((2, -1)).transpose().astype("int32") paddings = paddings.flatten().tolist() - if auto_pad == "SAME_UPPER" or auto_pad == "SAME_LOWER": - assert -1 not in input_shape, 'SAME_UPPER and SAME_LOWER does not yet support dynamic shapes' + if auto_pad in ["SAME_UPPER", "SAME_LOWER"]: + # Warning: SAME_UPPER and SAME_LOWER does not yet support dynamic shapes + if input_shape[2] == -1 or input_shape[3] == -1: + _logger.warning( + 'SAME_UPPER and SAME_LOWER does not yet support dynamic shapes, the conversion result may have a diff!!!' + ) pad_h = _get_same_padding(input_shape[2], kernel_shape[0], strides[0], auto_pad) pad_w = _get_same_padding(input_shape[3], kernel_shape[1], -- GitLab