Conv1DTranspose

class Conv1DTranspose(channels, kernel_size, strides=1, padding=0, output_padding=0, dilation=1, groups=1, layout='NCW', activation=None, use_bias=True, weight_initializer=None, bias_initializer='zeros', in_channels=0, **kwargs)

Transposed 1D convolution layer (sometimes called Deconvolution).

The need for transposed convolutions generally arises from the desire to use a transformation going in the opposite direction of a normal convolution, i.e., from something that has the shape of the output of some convolution to something that has the shape of its input while maintaining a connectivity pattern that is compatible with said convolution.

If in_channels is not specified, Parameter initialization will be deferred to the first time forward is called and in_channels will be inferred from the shape of input data.

Parameters:
channels : int

The dimensionality of the output space, i.e. the number of output channels (filters) in the convolution.

kernel_size :int or tuple/list of 1 int

Specifies the dimensions of the convolution window.

strides : int or tuple/list of 1 int

Specify the strides of the convolution.

padding : int or a tuple/list of 1 int,

If padding is non-zero, then the input is implicitly zero-padded on both sides for padding number of points

output_padding: int or a tuple/list of 1 int

Controls the amount of implicit zero-paddings on both sides of the output for output_padding number of points for each dimension.

dilation : int or tuple/list of 1 int

Controls the spacing between the kernel points; also known as the a trous algorithm

groups : int

Controls the connections between inputs and outputs. At groups=1, all inputs are convolved to all outputs. At groups=2, the operation becomes equivalent to having two conv layers side by side, each seeing half the input channels, and producing half the output channels, and both subsequently concatenated.

layout : str, default ‘NCW’

Dimension ordering of data and weight. Only supports ‘NCW’ layout for now. ‘N’, ‘C’, ‘W’ stands for batch, channel, and width (time) dimensions respectively. Convolution is applied on the ‘W’ dimension.

in_channels : int, default 0

The number of input channels to this layer. If not specified, initialization will be deferred to the first time forward is called and in_channels will be inferred from the shape of input data.

activation : str

Activation function to use. See Activation(). If you don’t specify anything, no activation is applied (ie. “linear” activation: a(x) = x).

use_bias : bool

Whether the layer uses a bias vector.

weight_initializer : str or Initializer

Initializer for the weight weights matrix.

bias_initializer : str or Initializer

Initializer for the bias vector.

Inputs:
  • data: 3D input tensor with shape (batch_size, in_channels, width) when layout is NCW. For other layouts shape is permuted accordingly.
Outputs:
  • out: 3D output tensor with shape (batch_size, channels, out_width) when layout is NCW. out_width is calculated as:

    out_width = (width-1)*strides-2*padding+kernel_size+output_padding