Package ai.djl.nn.convolutional
Class Conv1dTranspose
- java.lang.Object
-
- ai.djl.nn.AbstractBlock
-
- ai.djl.nn.convolutional.Deconvolution
-
- ai.djl.nn.convolutional.Conv1dTranspose
-
- All Implemented Interfaces:
Block
public class Conv1dTranspose extends Deconvolution
AConv1dTranspose
layer works similar toDeconvolution
layer with the exception of the number of dimension it operates on being only one, which isLayoutType.WIDTH
. The channel of the input data may be more than one, depending on what data is processed. Each filter slides through the data with only one direction of movement along the dimension itself.The input to a
Conv1dTranspose
is anNDList
with a single 3-DNDArray
. The layout of theNDArray
must be "NCW". The shapes aredata: (batch_size, channel, width)
weight: (num_filter, channel, kernel[0])
bias: (num_filter,)
out: (batch_size, num_filter, out_width)
out_width = f(width, kernel[0], pad[0], oPad[0], stride[0], dilate[0])
where f(x, k, p, oP, s, d) = (x-1)*s-2*p+k+oP
Both
weight
andbias
are learn-able parameters.- See Also:
Deconvolution
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Conv1dTranspose.Builder
The Builder to construct aConv1dTranspose
type ofBlock
.-
Nested classes/interfaces inherited from class ai.djl.nn.convolutional.Deconvolution
Deconvolution.DeconvolutionBuilder<T extends Deconvolution.DeconvolutionBuilder>
-
-
Field Summary
-
Fields inherited from class ai.djl.nn.convolutional.Deconvolution
bias, dilation, filters, groups, includeBias, kernelShape, outPadding, padding, stride, weight
-
Fields inherited from class ai.djl.nn.AbstractBlock
children, inputNames, inputShapes, parameters, version
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Conv1dTranspose.Builder
builder()
Creates a builder to build aConv1dTranspose
.static NDList
conv1dTranspose(NDArray input, NDArray weight)
Applies 1D deconvolution over an input signal composed of several input planes.static NDList
conv1dTranspose(NDArray input, NDArray weight, NDArray bias)
Applies 1D deconvolution over an input signal composed of several input planes.static NDList
conv1dTranspose(NDArray input, NDArray weight, NDArray bias, Shape stride)
Applies 1D deconvolution over an input signal composed of several input planes.static NDList
conv1dTranspose(NDArray input, NDArray weight, NDArray bias, Shape stride, Shape padding)
Applies 1D deconvolution over an input signal composed of several input planes.static NDList
conv1dTranspose(NDArray input, NDArray weight, NDArray bias, Shape stride, Shape padding, Shape outPadding)
Applies 1D deconvolution over an input signal composed of several input planes.static NDList
conv1dTranspose(NDArray input, NDArray weight, NDArray bias, Shape stride, Shape padding, Shape outPadding, Shape dilation)
Applies 1D deconvolution over an input signal composed of several input planes.static NDList
conv1dTranspose(NDArray input, NDArray weight, NDArray bias, Shape stride, Shape padding, Shape outPadding, Shape dilation, int groups)
Applies 1D convolution over an input signal composed of several input planes.protected LayoutType[]
getExpectedLayout()
Returns the expected layout of the input.protected java.lang.String
getStringLayout()
Returns the string representing the layout of the input.protected int
numDimensions()
Returns the number of dimensions of the input.-
Methods inherited from class ai.djl.nn.convolutional.Deconvolution
beforeInitialize, forwardInternal, getOutputShapes, loadMetadata, prepare
-
Methods inherited from class ai.djl.nn.AbstractBlock
addChildBlock, addParameter, cast, clear, describeInput, forward, forward, forwardInternal, getChildren, getDirectParameters, getParameters, initialize, initializeChildBlocks, isInitialized, loadParameters, readInputShapes, saveInputShapes, saveMetadata, saveParameters, setInitializer, setInitializer, setInitializer, toString
-
-
-
-
Method Detail
-
getExpectedLayout
protected LayoutType[] getExpectedLayout()
Returns the expected layout of the input.- Specified by:
getExpectedLayout
in classDeconvolution
- Returns:
- the expected layout of the input
-
getStringLayout
protected java.lang.String getStringLayout()
Returns the string representing the layout of the input.- Specified by:
getStringLayout
in classDeconvolution
- Returns:
- the string representing the layout of the input
-
numDimensions
protected int numDimensions()
Returns the number of dimensions of the input.- Specified by:
numDimensions
in classDeconvolution
- Returns:
- the number of dimensions of the input
-
conv1dTranspose
public static NDList conv1dTranspose(NDArray input, NDArray weight)
Applies 1D deconvolution over an input signal composed of several input planes.- Parameters:
input
- the inputNDArray
of shape (batchSize, inputChannel, width)weight
- filtersNDArray
of shape (outChannel, inputChannel/groups, width)- Returns:
- the output of the conv1dTranspose operation
-
conv1dTranspose
public static NDList conv1dTranspose(NDArray input, NDArray weight, NDArray bias)
Applies 1D deconvolution over an input signal composed of several input planes.- Parameters:
input
- the inputNDArray
of shape (batchSize, inputChannel, width)weight
- filtersNDArray
of shape (outChannel, inputChannel/groups, width)bias
- biasNDArray
of shape (outChannel)- Returns:
- the output of the conv1dTranspose operation
-
conv1dTranspose
public static NDList conv1dTranspose(NDArray input, NDArray weight, NDArray bias, Shape stride)
Applies 1D deconvolution over an input signal composed of several input planes.- Parameters:
input
- the inputNDArray
of shape (batchSize, inputChannel, width)weight
- filtersNDArray
of shape (outChannel, inputChannel/groups, width)bias
- biasNDArray
of shape (outChannel)stride
- the stride of the deconvolving kernel: Shape(width)- Returns:
- the output of the conv1dTranspose operation
-
conv1dTranspose
public static NDList conv1dTranspose(NDArray input, NDArray weight, NDArray bias, Shape stride, Shape padding)
Applies 1D deconvolution over an input signal composed of several input planes.- Parameters:
input
- the inputNDArray
of shape (batchSize, inputChannel, width)weight
- filtersNDArray
of shape (outChannel, inputChannel/groups, width)bias
- biasNDArray
of shape (outChannel)stride
- the stride of the deconvolving kernel: Shape(width)padding
- implicit paddings on both sides of the input: Shape(width)- Returns:
- the output of the conv1dTranspose operation
-
conv1dTranspose
public static NDList conv1dTranspose(NDArray input, NDArray weight, NDArray bias, Shape stride, Shape padding, Shape outPadding)
Applies 1D deconvolution over an input signal composed of several input planes.- Parameters:
input
- the inputNDArray
of shape (batchSize, inputChannel, width)weight
- filtersNDArray
of shape (outChannel, inputChannel/groups, width)bias
- biasNDArray
of shape (outChannel)stride
- the stride of the deconvolving kernel: Shape(width)padding
- implicit paddings on both sides of the input: Shape(width)outPadding
- Controls the amount of implicit zero-paddings on both sides of the output for outputPadding number of points for each dimension.- Returns:
- the output of the conv1dTranspose operation
-
conv1dTranspose
public static NDList conv1dTranspose(NDArray input, NDArray weight, NDArray bias, Shape stride, Shape padding, Shape outPadding, Shape dilation)
Applies 1D deconvolution over an input signal composed of several input planes.- Parameters:
input
- the inputNDArray
of shape (batchSize, inputChannel, width)weight
- filtersNDArray
of shape (outChannel, inputChannel/groups, width)bias
- biasNDArray
of shape (outChannel)stride
- the stride of the deconvolving kernel: Shape(width)padding
- implicit paddings on both sides of the input: Shape(width)outPadding
- Controls the amount of implicit zero-paddings on both sides of the output for outputPadding number of points for each dimension.dilation
- the spacing between kernel elements: Shape(width)- Returns:
- the output of the conv1dTranspose operation
-
conv1dTranspose
public static NDList conv1dTranspose(NDArray input, NDArray weight, NDArray bias, Shape stride, Shape padding, Shape outPadding, Shape dilation, int groups)
Applies 1D convolution over an input signal composed of several input planes.- Parameters:
input
- the inputNDArray
of shape (batchSize, inputChannel, width)weight
- filtersNDArray
of shape (outChannel, inputChannel/groups, width)bias
- biasNDArray
of shape (outChannel)stride
- the stride of the deconvolving kernel: Shape(width)padding
- implicit paddings on both sides of the input: Shape(width)outPadding
- Controls the amount of implicit zero-paddings on both sides of the output for outputPadding number of points for each dimension. Shape(width)dilation
- the spacing between kernel elements: Shape(width)groups
- split input into groups: input channel(input.size(1)) should be divisible by the number of groups- Returns:
- the output of the conv1dTranspose operation
-
builder
public static Conv1dTranspose.Builder builder()
Creates a builder to build aConv1dTranspose
.- Returns:
- a new builder
-
-