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 , C i n , L ) and output ( N , C o u t , L o u t ) can be precisely described as: ( N , C o u t , L o u t ) can be precisely described as:
o u t ( N i , C o u t j ) = b i a s ( C o u t j ) + ∑ C i n − 1 k = 0 w e i g h t ( C o u t j , k ) ⋆ i n p u t ( N i , k )
Parameters:
in_channels (int ) – Number of channels in the input imageout_channels (int ) – Number of channels produced by the convolutionkernel_size (int or tuple ) – Size of the convolving kernelstride (int or tuple , optional ) – Stride of the convolutionpadding (int or tuple , optional ) – Zero-padding added to both sides of the inputdilation (int or tuple , optional ) – Spacing between kernel elementsgroups (int , optional ) – Number of blocked connections from input channels to output channelsbias (bool , optional ) – If True, adds a learnable bias to the output
Shape:
Input: ( N , C i n , L i n ) Output: ( N , C o u t , L o u t ) where L o u t = f l o o r ( ( L i n + 2 ∗ p a d d i n g − d i l a t i o n ∗ ( k e r n e l _ s i z e − 1 ) − 1 ) / s t r i d e + 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 imageout_channels (int ) – Number of channels produced by the convolutionkernel_size (int or tuple ) – Size of the convolving kernelstride (int or tuple , optional ) – Stride of the convolutionpadding (int or tuple , optional ) – Zero-padding added to both sides of the inputoutput_padding (int or tuple , optional ) – Zero-padding added to one side of the outputgroups (int , optional ) – Number of blocked connections from input channels to output channelsbias (bool , optional ) – If True, adds a learnable bias to the output
Shape:
Input: ( N , C i n , L i n ) (N,Cin,Lin) Output: ( N , C o u t , L o u t ) where L o u t = ( L i n − 1 ) ∗ s t r i d e − 2 ∗ p a d d i n g + k e r n e l _ s i z e + o u t p u t _ p a d d i n g
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