Conv1D

neuralpy.layers.convolutional.Conv1D(filters, kernel_size, input_shape=None, stride=1, padding=0, dilation=1, groups=1, bias=True, name=None)
info

Conv1D Layer is mostly stable and can be used for any project. In the future, any chance of breaking changes is very low.

Applies a 1D convolution over an input signal composed of several input planes.

To learn more about Conv1D layers, please check PyTorch documentation

Supported Arguments:

  • filters: (Integer) Size of the filter
  • kernel_size: (Integer | Tuple) Kernel size of the layer
  • input_shape=None: (Tuple) A tuple with the shape in following format (input_channel, X). No need of this argument layers except the initial layer.
  • stride=1: (Integer | Tuple) Stride for the conv.
  • padding=0: (Integer | Tuple) Padding for the conv layer.
  • dilation=1: (Integer | Tuple) Controls the spacing between the kernel elements
  • groups=1: (Integer) Controls the connections between inputs and outputs.
  • bias=True: (Boolean) If true then uses the bias, Defaults to true
  • name=None: (String) Name of the layer, if not provided then automatically calculates a unique name for the layer

Example Code

from neuralpy.models import Sequential
from neuralpy.layers.convolutional import Conv1D
# Making the model
model = Sequential()
model.add(Conv1D(filters=8, kernel_size=3, input_shape=(1, 28), stride=1, name="first cnn"))
model.add(Conv1D(filters=16, kernel_size=3, stride=1, name="second cnn"))