From 2d1b38eed615ea8099c923770ac96d26e23dfa04 Mon Sep 17 00:00:00 2001 From: Channingss Date: Fri, 6 Nov 2020 11:02:32 +0000 Subject: [PATCH] upsample bug fix --- x2paddle/op_mapper/onnx2paddle/opset9/opset.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x2paddle/op_mapper/onnx2paddle/opset9/opset.py b/x2paddle/op_mapper/onnx2paddle/opset9/opset.py index ead2370..e5e23b1 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') -- GitLab