diff --git a/x2paddle/op_mapper/onnx2paddle/opset9/opset.py b/x2paddle/op_mapper/onnx2paddle/opset9/opset.py index ead2370efef230e8dcccaede2d43b082273dfe32..e5e23b1739457bc2b70423469eb4a8a5242ff777 100644 --- a/x2paddle/op_mapper/onnx2paddle/opset9/opset.py +++ b/x2paddle/op_mapper/onnx2paddle/opset9/opset.py @@ -339,7 +339,11 @@ class OpSet9(): inputs['out_shape'] = var_hw elif node.layer_type == 'Upsample': val_scales = self.graph.get_input_node(node, idx=1, copy=True) - inputs['scale'] = val_scales + value = _const_weight_or_none(val_scales) + if value is not None and value[-1] == value[-2]: + inputs['scale'] = value.tolist()[-1] + else: + inputs['scale'] = val_scales attr = {'name': string(node.layer_name)} mode = node.get_attr('mode', 'nearest')