torch.nn.
Conv1d
(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True)
In the simplest case, the output value of the layer with input size (N,Cin,L) and output (N,Cout,Lout) can be precisely described as:(N,Cout,Lout) can be precisely described as:
out(Ni,Coutj)=bias(Coutj)+∑Cin−1k=0weight(Coutj,k)⋆input(Ni,k)
Parameters: |
-
in_channels (int) – Number of channels in the input image
-
out_channels (int) – Number of channels produced by the convolution
-
kernel_size (int or tuple) – Size of the convolving kernel
-
stride (int or tuple, optional) – Stride of the convolution
-
padding (int or tuple, optional) – Zero-padding added to both sides of the input
-
dilation (int or tuple, optional) – Spacing between kernel elements
-
groups (int, optional) – Number of blocked connections from input channels to output channels
-
bias (bool, optional) – If True, adds a learnable bias to the output
|
Shape:
-
- Input: (N,Cin,Lin)
- Output: (N,Cout,Lout) where
-
Lout=floor((Lin+2∗padding−dilation∗(kernel_size−1)−1)/stride+1)
Variables: |
-
weight (Tensor) – the learnable weights of the module of shape (out_channels, in_channels, kernel_size)
-
bias (Tensor) – the learnable bias of the module of shape (out_channels)
|
Examples:
>>> m = nn.Conv1d(16, 33, 3, stride=2)
>>> input = autograd.Variable(torch.randn(20, 16, 50))
>>> output = m(input)
________________________________________
torch.nn.
ConvTranspose1d
(in_channels, out_channels, kernel_size, stride=1, padding=0, output_padding=0, groups=1, bias=True, dilation=1)
Parameters: |
-
in_channels (int) – Number of channels in the input image
-
out_channels (int) – Number of channels produced by the convolution
-
kernel_size (int or tuple) – Size of the convolving kernel
-
stride (int or tuple, optional) – Stride of the convolution
-
padding (int or tuple, optional) – Zero-padding added to both sides of the input
-
output_padding (int or tuple, optional) – Zero-padding added to one side of the output
-
groups (int, optional) – Number of blocked connections from input channels to output channels
-
bias (bool, optional) – If True, adds a learnable bias to the output
|
Shape:
-
- Input: (N,Cin,Lin)(N,Cin,Lin)
- Output: (N,Cout,Lout) where
-
Lout=(Lin−1)∗stride−2∗padding+kernel_size+output_padding
Variables: |
-
weight (Tensor) – the learnable weights of the module of shape (in_channels, out_channels, kernel_size[0], kernel_size[1])
-
bias (Tensor) – the learnable bias of the module of shape (out_channels)
|
from: http://pytorch.org/docs/0.1.12/nn.html