Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

Keras Layer
DL4J Equivalent
Supported

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

source

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

source

Imports a Keras Conv1D layer as a DL4J Convolution1DLayer.

Constructor

getConvolution1DLayer

getInputPreprocessor

setWeights


KerasConvolution3D

source

Imports a Keras Conv3D layer as a DL4J 3D ConvolutionLayer.


KerasAtrousConvolution1D / KerasAtrousConvolution2D

source 1D | source 2D

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

source

Imports a Keras SeparableConv2D layer as a DL4J SeparableConvolution2DLayer. Depthwise and pointwise weight tensors are loaded separately from the HDF5 file.


KerasDeconvolution2D (Conv2DTranspose)

source

Imports a Keras Conv2DTranspose layer as a DL4J Deconvolution2DLayer.


Cropping Layers

KerasCropping1D

source

KerasCropping2D

source

KerasCropping3D

source


Upsampling Layers

KerasUpsampling1D

source

KerasUpsampling2D

source

KerasUpsampling3D

source


Zero Padding Layers

KerasZeroPadding1D

source

KerasZeroPadding2D

source

KerasZeroPadding3D

source


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 Conv1D with groups if available in your Keras version, or restructure the model.

  • Conv3DTranspose: no DL4J equivalent at this time.

  • Dilation: both the legacy AtrousConvolution names (Keras 1) and the dilation_rate argument (Keras 2) on standard Conv layers are handled transparently.

Last updated

Was this helpful?