未验证 提交 28a18af0 编写于 作者: W wangguanzhong 提交者: GitHub

fix output_padding in conv (#33429)

上级 bad3bebf
...@@ -98,7 +98,7 @@ class _ConvNd(layers.Layer): ...@@ -98,7 +98,7 @@ class _ConvNd(layers.Layer):
'kernel_size') 'kernel_size')
self._padding = padding self._padding = padding
self._padding_mode = padding_mode self._padding_mode = padding_mode
self.output_padding = output_padding self._output_padding = output_padding
if dims != 1: if dims != 1:
self._updated_padding, self._padding_algorithm = _update_padding_nd( self._updated_padding, self._padding_algorithm = _update_padding_nd(
padding, channel_last, dims) padding, channel_last, dims)
...@@ -163,7 +163,7 @@ class _ConvNd(layers.Layer): ...@@ -163,7 +163,7 @@ class _ConvNd(layers.Layer):
main_str += ', padding={_padding}' main_str += ', padding={_padding}'
if self._padding_mode is not 'zeros': if self._padding_mode is not 'zeros':
main_str += ', padding_mode={_padding_mode}' main_str += ', padding_mode={_padding_mode}'
if self.output_padding != 0: if self._output_padding != 0:
main_str += ', output_padding={_output_padding}' main_str += ', output_padding={_output_padding}'
if self._dilation != [1] * len(self._dilation): if self._dilation != [1] * len(self._dilation):
main_str += ', dilation={_dilation}' main_str += ', dilation={_dilation}'
...@@ -502,7 +502,7 @@ class Conv1DTranspose(_ConvNd): ...@@ -502,7 +502,7 @@ class Conv1DTranspose(_ConvNd):
self.weight, self.weight,
bias=self.bias, bias=self.bias,
output_size=output_size, output_size=output_size,
output_padding=self.output_padding, output_padding=self._output_padding,
padding=self._padding, padding=self._padding,
stride=self._stride, stride=self._stride,
dilation=self._dilation, dilation=self._dilation,
...@@ -810,7 +810,7 @@ class Conv2DTranspose(_ConvNd): ...@@ -810,7 +810,7 @@ class Conv2DTranspose(_ConvNd):
def forward(self, x, output_size=None): def forward(self, x, output_size=None):
if output_size is None: if output_size is None:
output_padding = self.output_padding output_padding = self._output_padding
else: else:
output_padding = 0 output_padding = 0
...@@ -1139,7 +1139,7 @@ class Conv3DTranspose(_ConvNd): ...@@ -1139,7 +1139,7 @@ class Conv3DTranspose(_ConvNd):
def forward(self, x, output_size=None): def forward(self, x, output_size=None):
if output_size is None: if output_size is None:
output_padding = self.output_padding output_padding = self._output_padding
else: else:
output_padding = 0 output_padding = 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册