diff --git a/x2paddle/op_mapper/onnx2paddle/onnx_op_mapper.py b/x2paddle/op_mapper/onnx2paddle/onnx_op_mapper.py index 7a0ec49a78bb8612fad5b1953eb23f980c540673..28ff1d35e2fee3db4dc6234f36fd9510b1d77be3 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 ac3035a918e7e5de5a317242d73889562116baf2..808dd39fbef8fa883b4520cc9831645bfc2b7b14 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],