Skip to content

Instantly share code, notes, and snippets.

@ugo-nama-kun
Last active November 20, 2022 05:36
Show Gist options
  • Save ugo-nama-kun/9bfb435c99f503c40e2765819c6272ff to your computer and use it in GitHub Desktop.
Save ugo-nama-kun/9bfb435c99f503c40e2765819c6272ff to your computer and use it in GitHub Desktop.
Deconvolution の出力サイズを計算するやつ
def deconvsize(w_in, k, stride, pad, output_pad):
return (w_in - 1) * stride - 2 * pad + k + output_pad
@ugo-nama-kun
Copy link
Author

from
https://qiita.com/kamata1729/items/41adf8b99a7ce070f79a
and
https://pytorch.org/docs/stable/generated/torch.nn.ConvTranspose2d.html#torch.nn.ConvTranspose2d

$H_{out} = (H_{in} - 1)\times stride[0] - 2 \times pad[0] + ksize[0] + {\rm outputpadding}[0]$
$W_{out} = (W_{in} - 1)\times stride[1] - 2 \times pad[1] + ksize[1] + {\rm outputpadding}[1] $

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment