From 8a5b3599bdfe59487f57f39a2a21b15a7fba4d03 Mon Sep 17 00:00:00 2001 From: wjj19950828 Date: Mon, 7 Mar 2022 20:56:44 +0800 Subject: [PATCH] fixed pad op --- x2paddle/op_mapper/onnx2paddle/opset9/opset.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/x2paddle/op_mapper/onnx2paddle/opset9/opset.py b/x2paddle/op_mapper/onnx2paddle/opset9/opset.py index c9d2e93..381b31c 100755 --- a/x2paddle/op_mapper/onnx2paddle/opset9/opset.py +++ b/x2paddle/op_mapper/onnx2paddle/opset9/opset.py @@ -630,12 +630,11 @@ class OpSet9(): layer_attrs["pad"] = paddings paddle_op = "custom_layer:PadAllDim4WithOneInput" else: - pad_data = pads - pad_data1 = pad_data[0::2] + pad_data_temp = pads[0::2] pad_data_all = [] - for i in range(len(pad_data1)): - pad_data_all.append(pad_data[i]) - pad_data_all.append(pad_data[len(pad_data1) + i]) + for i in range(len(pad_data_temp)): + pad_data_all.append(pads[i]) + pad_data_all.append(pads[len(pad_data_temp) + i]) layer_attrs["pad"] = pad_data_all self.paddle_graph.add_layer( -- GitLab