Convolutional Layers
DL4J equivalents and API reference for Keras convolutional layers — Conv1D, Conv2D, Conv3D, SeparableConv2D, transposed convolutions, cropping, upsampling, and zero-padding.
Keras Convolutional Layer Import
Convolutional layer support is implemented in the layers/convolutional package.
Support Summary
Conv1D
Convolution1DLayer
Yes
Conv2D
ConvolutionLayer
Yes
Conv3D
ConvolutionLayer (3D)
Yes
AtrousConvolution1D
Convolution1DLayer (with dilation)
Yes
AtrousConvolution2D
ConvolutionLayer (with dilation)
Yes
SeparableConv1D
—
No
SeparableConv2D
SeparableConvolution2DLayer
Yes
DepthwiseConv2D
DepthwiseConvolution2DLayer
Yes
Conv2DTranspose
Deconvolution2DLayer
Yes
Conv3DTranspose
—
No
Cropping1D
Cropping1DLayer
Yes
Cropping2D
Cropping2DLayer
Yes
Cropping3D
Cropping3DLayer
Yes
UpSampling1D
Upsampling1DLayer
Yes
UpSampling2D
Upsampling2DLayer
Yes
UpSampling3D
Upsampling3DLayer
Yes
ZeroPadding1D
ZeroPadding1DLayer
Yes
ZeroPadding2D
ZeroPaddingLayer
Yes
ZeroPadding3D
ZeroPadding3DLayer
Yes
KerasConvolution2D
Imports a Keras Conv2D layer as a DL4J ConvolutionLayer.
Constructor
Pass-through constructor. kerasVersion is the major Keras version (1 or 2).
getConvolution2DLayer
Returns the DL4J ConvolutionLayer.
getOutputType
KerasConvolution1D
Imports a Keras Conv1D layer as a DL4J Convolution1DLayer.
Constructor
getConvolution1DLayer
getInputPreprocessor
setWeights
KerasConvolution3D
Imports a Keras Conv3D layer as a DL4J 3D ConvolutionLayer.
KerasAtrousConvolution1D / KerasAtrousConvolution2D
Imports Keras 1.x AtrousConvolution (dilated convolution) layers. In Keras 2, dilation is specified via the dilation_rate argument of standard Conv layers; the importer handles both representations.
KerasSeparableConvolution2D
Imports a Keras SeparableConv2D layer as a DL4J SeparableConvolution2DLayer. Depthwise and pointwise weight tensors are loaded separately from the HDF5 file.
KerasDeconvolution2D (Conv2DTranspose)
Imports a Keras Conv2DTranspose layer as a DL4J Deconvolution2DLayer.
Cropping Layers
KerasCropping1D
KerasCropping2D
KerasCropping3D
Upsampling Layers
KerasUpsampling1D
KerasUpsampling2D
KerasUpsampling3D
Zero Padding Layers
KerasZeroPadding1D
KerasZeroPadding2D
KerasZeroPadding3D
Notes
Data format: Keras defaults to channels-last (
NHWC). DL4J uses channels-first (NCHW) internally. The importer transposes weight tensors during loading so you do not need to manually convert weights.SeparableConv1D: not supported. Use
Conv1Dwithgroupsif available in your Keras version, or restructure the model.Conv3DTranspose: no DL4J equivalent at this time.
Dilation: both the legacy
AtrousConvolutionnames (Keras 1) and thedilation_rateargument (Keras 2) on standard Conv layers are handled transparently.
Last updated
Was this helpful?