From 8f5a6e94ae841a0ac7431d339e3c290884ab02f5 Mon Sep 17 00:00:00 2001 From: 462630221 <462630221@qq.com> Date: Sat, 20 Feb 2021 15:42:38 +0800 Subject: [PATCH] [opt:fuse_pad_into_conv] remove auto_pad, when use pads Signed-off-by: 462630221 <462630221@qq.com> --- onnxoptimizer/passes/fuse_pad_into_conv.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/onnxoptimizer/passes/fuse_pad_into_conv.h b/onnxoptimizer/passes/fuse_pad_into_conv.h index a348a0206..782a1632d 100644 --- a/onnxoptimizer/passes/fuse_pad_into_conv.h +++ b/onnxoptimizer/passes/fuse_pad_into_conv.h @@ -165,6 +165,11 @@ struct FusePadIntoConv final : public PredicateBasedPass { conv_pads[conv_pads_size / 2 + j] += pads[pads_size / 2 + i]; } + // Clean the auto_pad + if (conv->hasAttribute(Symbol("auto_pad"))){ + conv->removeAttribute(Symbol("auto_pad")); + } + conv->is_(kpads, std::move(conv_pads)); conv->replaceInput(0, pad->inputs()[0]); pad->destroy();