NN Convtranspose1d
NN Convtranspose1d
Conv1d 本質是縮減
Only 2D, 3D, 4D, 5D padding with non-constant padding are supported for now
nn.ConvTranspose1d(in_channels = 7, out_channels = 6, kernel_size=10,
stride=2, output_padding=0, bias=False)
// torch.Size([ in_channels , out_channels, kernel_size ])
// torch.Size([7, 6, 10])
Output of print
--------------------------------------------------------------------------------------------
372 = 6* 1 + 100* 3 + 6* 1 + 6*10
import torch.nn as nn
import torch
m = nn.ConvTranspose1d(4, 2, kernel_size=3,
stride=2, output_padding=0, bias=False)
print(m.weight.shape)
m.weight = nn.Parameter(para)
data = torch.tensor([ [1.0, 1.0, 2.0, 0.0, 3.0],
[3.0, 0.0, 0.0, 1.0, 2.0],
[1.0, 1.0, 2.0, 0.0, 3.0],
[10.0, 1.0, 2.0, 0.0, 3.0] ])
print(m(data))
print(m(data).shape)
-----------------------------------------------------------------------------------------
測輸出 dim 用
import torch.nn as nn
import torch
m = nn.ConvTranspose1d(2, 5, kernel_size=3,
stride=2, output_padding=0, bias=False)
print(m(data).shape)
print(m(data))