public class Conv1D extends Convolution
Conv1D
layer works similar to Convolution
layer with the exception of the
number of dimension it operates on being only one, which is LayoutType.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.
Commonly, this kind of convolution layer, as proposed in this paper is used in tasks utilizing serial
data, enabling convolutional processing of 1-dimensional data such as time-series data (stock
price, weather, ECG) and text/speech data without the need of transforming it to 2-dimensional
data to be processed by Conv2D
, though this is quite a common technique as well.
The input to a Conv1D
is an NDList
with a single 3-D NDArray
. The layout of the NDArray
must be "NCW". The
shapes are
data: (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], stride[0], dilate[0])
where f(x, k, p, s, d) = floor((x + 2 * p - d * (k - 1) - 1)/s) + 1
Both weight
and bias
are learn-able parameters.
Modifier and Type | Class and Description |
---|---|
static class |
Conv1D.Builder
|
Convolution.ConvolutionBuilder<T extends Convolution.ConvolutionBuilder>
bias, dilate, includeBias, kernel, numFilters, numGroups, pad, stride, weight
inputNames, inputShapes
Modifier and Type | Method and Description |
---|---|
static Conv1D.Builder |
builder()
Creates a builder to build a
Conv1D . |
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.
|
beforeInitialize, forward, getDirectParameters, getOutputShapes, getParameterShape, loadParameters, saveParameters
getChildren, initialize, toString
cast, clear, describeInput, getParameters, isInitialized, readInputShapes, saveInputShapes, setInitializer, setInitializer
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forward, validateLayout
protected LayoutType[] getExpectedLayout()
getExpectedLayout
in class Convolution
protected java.lang.String getStringLayout()
getStringLayout
in class Convolution
protected int numDimensions()
numDimensions
in class Convolution
public static Conv1D.Builder builder()
Conv1D
.