From 28a18af023e97831d617594e88327a8c8e7531f0 Mon Sep 17 00:00:00 2001 From: wangguanzhong Date: Wed, 9 Jun 2021 10:42:29 +0800 Subject: [PATCH] fix output_padding in conv (#33429) --- python/paddle/nn/layer/conv.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/python/paddle/nn/layer/conv.py b/python/paddle/nn/layer/conv.py index 2de065d62a4..51eab0d1838 100644 --- a/python/paddle/nn/layer/conv.py +++ b/python/paddle/nn/layer/conv.py @@ -98,7 +98,7 @@ class _ConvNd(layers.Layer): 'kernel_size') self._padding = padding self._padding_mode = padding_mode - self.output_padding = output_padding + self._output_padding = output_padding if dims != 1: self._updated_padding, self._padding_algorithm = _update_padding_nd( padding, channel_last, dims) @@ -163,7 +163,7 @@ class _ConvNd(layers.Layer): main_str += ', padding={_padding}' if self._padding_mode is not 'zeros': main_str += ', padding_mode={_padding_mode}' - if self.output_padding != 0: + if self._output_padding != 0: main_str += ', output_padding={_output_padding}' if self._dilation != [1] * len(self._dilation): main_str += ', dilation={_dilation}' @@ -502,7 +502,7 @@ class Conv1DTranspose(_ConvNd): self.weight, bias=self.bias, output_size=output_size, - output_padding=self.output_padding, + output_padding=self._output_padding, padding=self._padding, stride=self._stride, dilation=self._dilation, @@ -810,7 +810,7 @@ class Conv2DTranspose(_ConvNd): def forward(self, x, output_size=None): if output_size is None: - output_padding = self.output_padding + output_padding = self._output_padding else: output_padding = 0 @@ -1139,7 +1139,7 @@ class Conv3DTranspose(_ConvNd): def forward(self, x, output_size=None): if output_size is None: - output_padding = self.output_padding + output_padding = self._output_padding else: output_padding = 0 -- GitLab