From 4118254ff4d28d2569356d6282583947619a1801 Mon Sep 17 00:00:00 2001 From: channingss Date: Tue, 5 Nov 2019 19:18:40 +0800 Subject: [PATCH] fix bug of convtranspose --- x2paddle/op_mapper/onnx_op_mapper.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/x2paddle/op_mapper/onnx_op_mapper.py b/x2paddle/op_mapper/onnx_op_mapper.py index a1b15b9..90b50ff 100644 --- a/x2paddle/op_mapper/onnx_op_mapper.py +++ b/x2paddle/op_mapper/onnx_op_mapper.py @@ -1231,10 +1231,11 @@ class ONNXOpMapper(OpMapper): def ConvTranspose(self, node): val_x = self.graph.get_input_node(node, idx=0, copy=True) val_w = self.graph.get_input_node(node, idx=1, copy=True) - val_b = self.graph.get_input_node(node, idx=2, copy=True) - + val_b = None + if len(node.layer.input)>2: + val_b = self.graph.get_input_node(node, idx=2, copy=True) + self.omit_nodes.append(val_b.layer_name) self.omit_nodes.append(val_w.layer_name) - self.omit_nodes.append(val_b.layer_name) val_y = self.graph.get_node(node.layer.output[0], copy=True) @@ -1272,7 +1273,7 @@ class ONNXOpMapper(OpMapper): 'dilation': dilations, 'groups': num_groups, 'param_attr': string(val_w.layer_name), - 'bias_attr': string(val_b.layer_name), + 'bias_attr': None if val_b is None else string(val_b.layer_name), 'name': string(node.layer_name), } node.fluid_code.add_layer(fluid_op, -- GitLab