0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Pytorch 畳み込み 転置畳み込み 動作 忘備録

Posted at
# 次元の計算について, 公式サイト通りとする.
    # ex. 
    # kernel_size = (2, 3) ならば, kernel_size[0] = 2, kernel_size[1] = 3
    # kernel_size = 5      ならば, kernel_size[0] = 5, kernel_size[1] = 5
    # padding = (3, 5)     ならば, padding[0] = 3, padding[1] = 5
    # padding = 2          ならば, padding[0] = 2, padding[1] = 2
    # stride = (4, 5)      ならば, stride[0] = 4, stride[1] = 5
    # stride = 3           ならば, stride[0] = 3, stride[1] = 3
    # dilation は, ここでは, 初期値 (1, 1) を 使用するため, dilation[0] = 1, dilation[1] = 1
    # output_padding は, ここでは, 初期値 0 を 使用するため, output_padding[0] = 0, output_padding[1] = 0
    
    # Conv2d
    # Input:  (N, Cin, Hin, Win)
    # Output: (N, Cout, Hout, Wout)
    # Hout = (Hin + 2 × padding[0] − dilation[0] × (kernel_size[0] − 1) − 1) / stride[0] + 1
    # Wout = (Win + 2 × padding[1] − dilation[1] × (kernel_size[1] − 1) − 1) / stride[1] + 1
 
    # ConvTranspose2d
    # Input:  (N, Cin, Hin, Win)
    # Output: (N, Cout, Hout, Wout)
    # Hout = (Hin − 1) × stride[0] − 2 × padding[0] + kernel_size[0] + output_padding[0]
    # Wout = (Win − 1) × stride[1] − 2 × padding[1] + kernel_size[1] + output_padding[1]
    
    # 1. Conv2d
    # Input:  (1, 3, 128, 128)
    # Hout =  (128 + 2 × 1 − 1 × (4 − 1) − 1) / 2 + 1 = 64
    # Wout =  (128 + 2 × 1 − 1 × (4 − 1) − 1) / 2 + 1 = 64
    # Output: (1, 256, 64, 64)
参考
https://start0x00url.net/2018/10/30/pytorch-%E3%81%AE%E5%8B%95%E4%BD%9C%E7%A2%BA%E8%AA%8D%E3%82%92%E3%81%97%E3%81%A6%E3%81%BF%E3%81%9F%EF%BC%88%EF%BC%91%EF%BC%91%EF%BC%89/
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?