提交 284e7f2a 编写于 作者: W wjj19950828

fixed convtranspose bug

上级 2a420846
...@@ -2128,12 +2128,33 @@ class OpSet9(): ...@@ -2128,12 +2128,33 @@ class OpSet9():
paddings, var_x = self._pad_if_asymmetric(node, pads, val_x) paddings, var_x = self._pad_if_asymmetric(node, pads, val_x)
if output_size is not None:
paddings = [0] * 4
total_paddings = list()
total_paddings.append((val_x.out_shapes[0][2] - 1) * strides[
0] + dilations[0] * (kernel_shape[0] - 1) + 1 + out_padding[0] -
output_size[0])
total_paddings.append((val_x.out_shapes[0][3] - 1) * strides[
1] + dilations[1] * (kernel_shape[1] - 1) + 1 + out_padding[1] -
output_size[1])
if auto_pad == "SAME_UPPER":
for i in range(len(total_paddings)):
paddings[2 * i] = total_paddings[0] - total_paddings[0] // 2
paddings[2 * i + 1] = total_paddings[0] // 2
else:
for i in range(len(total_paddings)):
paddings[2 * i] = total_paddings[0] // 2
paddings[2 * i + 1] = total_paddings[0] - total_paddings[
0] // 2
else:
output_size = [0, 0] output_size = [0, 0]
output_size[0] = (val_x.out_shapes[0][2] - 1 output_size[0] = (
val_x.out_shapes[0][2] - 1
) * strides[0] - 2 * paddings[0] + dilations[0] * ( ) * strides[0] - 2 * paddings[0] + dilations[0] * (
kernel_shape[0] - 1) + 1 + out_padding[0] kernel_shape[0] - 1) + 1 + out_padding[0]
output_size[1] = (val_x.out_shapes[0][3] - 1 output_size[1] = (
val_x.out_shapes[0][3] - 1
) * strides[1] - 2 * paddings[1] + dilations[1] * ( ) * strides[1] - 2 * paddings[1] + dilations[1] * (
kernel_shape[1] - 1) + 1 + out_padding[1] kernel_shape[1] - 1) + 1 + out_padding[1]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册