提交 071ecd5a 编写于 作者: W wjj19950828

fixed pad bug

上级 bb552d4b
...@@ -1221,18 +1221,16 @@ def aten_constant_pad_nd(mapper, graph, node): ...@@ -1221,18 +1221,16 @@ def aten_constant_pad_nd(mapper, graph, node):
layer_attrs["value"] = mapper.attrs[inputs_name[2]] layer_attrs["value"] = mapper.attrs[inputs_name[2]]
if padding_attr is not None: if padding_attr is not None:
padding_attr.reverse()
layer_inputs["x"] = inputs_name[0] layer_inputs["x"] = inputs_name[0]
kernel_name = "paddle.nn.functional.pad" kernel_name = "paddle.nn.functional.pad"
if len(padding_attr) == 2: if len(padding_attr) == 2:
layer_attrs["pad"] = [0, 0, 0, 0, 0, 0] + padding_attr layer_attrs["pad"] = [0, 0, 0, 0, 0, 0] + padding_attr
elif len(padding_attr) == 4: elif len(padding_attr) == 4:
layer_inputs["x"] = inputs_name[0]
layer_attrs["pad"] = [0, 0, 0, 0] + padding_attr layer_attrs["pad"] = [0, 0, 0, 0] + padding_attr
elif len(padding_attr) == 6: elif len(padding_attr) == 6:
layer_inputs["x"] = inputs_name[0]
layer_attrs["pad"] = [0, 0] + padding_attr layer_attrs["pad"] = [0, 0] + padding_attr
else: else:
layer_inputs["x"] = inputs_name[0]
layer_attrs["pad"] = padding_attr layer_attrs["pad"] = padding_attr
graph.add_layer( graph.add_layer(
kernel_name, kernel_name,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册