> For the complete documentation index, see [llms.txt](https://deeplearning4j.konduit.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://deeplearning4j.konduit.ai/en-1.0.0-rewrite/model-import/overview-1/supported-features.md).

# Supported Features

### Keras Model Import: Supported Features

This page provides the complete support matrix for Keras model import into DL4J. All mapping is implemented in the [deeplearning4j-modelimport](https://github.com/eclipse/deeplearning4j/tree/master/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras) module.

* Supported
* Not supported

***

### Layers

Mapping of Keras layers to DL4J is implemented in the [layers](https://github.com/eclipse/deeplearning4j/tree/master/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers) sub-module.

#### Core Layers

| Keras Layer            | DL4J Equivalent                                             | Supported |
| ---------------------- | ----------------------------------------------------------- | --------- |
| Dense                  | DenseLayer                                                  | Yes       |
| Activation             | ActivationLayer                                             | Yes       |
| Dropout                | DropoutLayer                                                | Yes       |
| Flatten                | CnnToFeedForwardPreProcessor / RnnToFeedForwardPreProcessor | Yes       |
| Reshape                | Reshape (via input preprocessor)                            | Yes       |
| Merge                  | MergeVertex                                                 | Yes       |
| Permute                | PermutePreProcessor                                         | Yes       |
| RepeatVector           | RepeatVector                                                | Yes       |
| Lambda                 | SameDiffLambda                                              | Yes       |
| ActivityRegularization | —                                                           | No        |
| Masking                | MaskZeroLayer                                               | Yes       |
| SpatialDropout1D       | DropoutLayer (spatial)                                      | Yes       |
| SpatialDropout2D       | DropoutLayer (spatial)                                      | Yes       |
| SpatialDropout3D       | DropoutLayer (spatial)                                      | Yes       |

#### Convolutional Layers

| 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     | SeparableConvolution2D             | Yes       |
| DepthwiseConv2D     | DepthwiseConvolution2D             | Yes       |
| Conv2DTranspose     | Deconvolution2D                    | Yes       |
| Conv3DTranspose     | —                                  | No        |
| Cropping1D          | Cropping1D                         | Yes       |
| Cropping2D          | Cropping2D                         | Yes       |
| Cropping3D          | Cropping3D                         | Yes       |
| UpSampling1D        | Upsampling1D                       | Yes       |
| UpSampling2D        | Upsampling2D                       | Yes       |
| UpSampling3D        | Upsampling3D                       | Yes       |
| ZeroPadding1D       | ZeroPadding1DLayer                 | Yes       |
| ZeroPadding2D       | ZeroPaddingLayer                   | Yes       |
| ZeroPadding3D       | ZeroPadding3DLayer                 | Yes       |

#### Pooling Layers

| Keras Layer            | DL4J Equivalent          | Supported |
| ---------------------- | ------------------------ | --------- |
| MaxPooling1D           | Subsampling1DLayer (MAX) | Yes       |
| MaxPooling2D           | SubsamplingLayer (MAX)   | Yes       |
| MaxPooling3D           | Subsampling3DLayer (MAX) | Yes       |
| AveragePooling1D       | Subsampling1DLayer (AVG) | Yes       |
| AveragePooling2D       | SubsamplingLayer (AVG)   | Yes       |
| AveragePooling3D       | Subsampling3DLayer (AVG) | Yes       |
| GlobalMaxPooling1D     | GlobalPoolingLayer (MAX) | Yes       |
| GlobalMaxPooling2D     | GlobalPoolingLayer (MAX) | Yes       |
| GlobalMaxPooling3D     | GlobalPoolingLayer (MAX) | Yes       |
| GlobalAveragePooling1D | GlobalPoolingLayer (AVG) | Yes       |
| GlobalAveragePooling2D | GlobalPoolingLayer (AVG) | Yes       |
| GlobalAveragePooling3D | GlobalPoolingLayer (AVG) | Yes       |

#### Locally-Connected Layers

| Keras Layer        | DL4J Equivalent    | Supported |
| ------------------ | ------------------ | --------- |
| LocallyConnected1D | LocallyConnected1D | Yes       |
| LocallyConnected2D | LocallyConnected2D | Yes       |

#### Recurrent Layers

| Keras Layer | DL4J Equivalent | Supported |
| ----------- | --------------- | --------- |
| SimpleRNN   | SimpleRnn       | Yes       |
| GRU         | —               | No        |
| LSTM        | LSTM            | Yes       |
| ConvLSTM2D  | —               | No        |

#### Embedding Layers

| Keras Layer | DL4J Equivalent        | Supported |
| ----------- | ---------------------- | --------- |
| Embedding   | EmbeddingSequenceLayer | Yes       |

#### Merge Layers

| Keras Layer               | DL4J Equivalent      | Supported |
| ------------------------- | -------------------- | --------- |
| Add / add                 | MergeVertex (add)    | Yes       |
| Multiply / multiply       | MergeVertex (mul)    | Yes       |
| Subtract / subtract       | MergeVertex (sub)    | Yes       |
| Average / average         | MergeVertex (avg)    | Yes       |
| Maximum / maximum         | MergeVertex (max)    | Yes       |
| Concatenate / concatenate | MergeVertex (concat) | Yes       |
| Dot / dot                 | —                    | No        |

#### Advanced Activation Layers

| Keras Layer     | DL4J Equivalent                   | Supported |
| --------------- | --------------------------------- | --------- |
| LeakyReLU       | ActivationLayer (LeakyReLU)       | Yes       |
| PReLU           | PReLULayer                        | Yes       |
| ELU             | ActivationLayer (ELU)             | Yes       |
| ThresholdedReLU | ActivationLayer (ThresholdedReLU) | Yes       |

#### Normalization Layers

| Keras Layer        | DL4J Equivalent    | Supported |
| ------------------ | ------------------ | --------- |
| BatchNormalization | BatchNormalization | Yes       |

#### Noise Layers

| Keras Layer     | DL4J Equivalent                | Supported |
| --------------- | ------------------------------ | --------- |
| GaussianNoise   | DropoutLayer (GaussianNoise)   | Yes       |
| GaussianDropout | DropoutLayer (GaussianDropout) | Yes       |
| AlphaDropout    | DropoutLayer (AlphaDropout)    | Yes       |

#### Layer Wrappers

| Keras Wrapper   | DL4J Equivalent | Supported |
| --------------- | --------------- | --------- |
| TimeDistributed | —               | No        |
| Bidirectional   | Bidirectional   | Yes       |

***

### Losses

[Source: KerasLossUtils](https://github.com/eclipse/deeplearning4j/blob/master/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLossUtils.java)

| Keras Loss                        | DL4J Equivalent           | Supported |
| --------------------------------- | ------------------------- | --------- |
| mean\_squared\_error              | MSE                       | Yes       |
| mean\_absolute\_error             | MAE                       | Yes       |
| mean\_absolute\_percentage\_error | MAPE                      | Yes       |
| mean\_squared\_logarithmic\_error | MSLE                      | Yes       |
| squared\_hinge                    | SquaredHinge              | Yes       |
| hinge                             | Hinge                     | Yes       |
| categorical\_hinge                | CategoricalHinge          | Yes       |
| logcosh                           | —                         | No        |
| categorical\_crossentropy         | CategoricalCrossEntropy   | Yes       |
| sparse\_categorical\_crossentropy | SparseMCXENT              | Yes       |
| binary\_crossentropy              | BinaryCrossEntropy        | Yes       |
| kullback\_leibler\_divergence     | KullbackLeiblerDivergence | Yes       |
| poisson                           | Poisson                   | Yes       |
| cosine\_proximity                 | CosineSimilarity          | Yes       |

***

### Activations

[Source: KerasActivationUtils](https://github.com/eclipse/deeplearning4j/blob/master/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasActivationUtils.java)

All standard Keras activations are supported:

| Keras Activation | DL4J Equivalent | Supported |
| ---------------- | --------------- | --------- |
| softmax          | Softmax         | Yes       |
| elu              | ELU             | Yes       |
| selu             | SELU            | Yes       |
| softplus         | Softplus        | Yes       |
| softsign         | Softsign        | Yes       |
| relu             | ReLU            | Yes       |
| tanh             | Tanh            | Yes       |
| sigmoid          | Sigmoid         | Yes       |
| hard\_sigmoid    | HardSigmoid     | Yes       |
| linear           | Identity        | Yes       |

***

### Initializers

[Source: KerasInitilizationUtils](https://github.com/eclipse/deeplearning4j/blob/master/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasInitilizationUtils.java)

All standard Keras weight initializers are supported:

| Keras Initializer | DL4J Equivalent             | Supported |
| ----------------- | --------------------------- | --------- |
| Zeros             | ZeroInitScheme              | Yes       |
| Ones              | OneInitScheme               | Yes       |
| Constant          | ConstantDistribution        | Yes       |
| RandomNormal      | NormalDistribution          | Yes       |
| RandomUniform     | UniformDistribution         | Yes       |
| TruncatedNormal   | TruncatedNormalDistribution | Yes       |
| VarianceScaling   | VarianceScalingInitScheme   | Yes       |
| Orthogonal        | OrthogonalInitScheme        | Yes       |
| Identity          | IdentityInitScheme          | Yes       |
| lecun\_uniform    | WeightInitLecunUniform      | Yes       |
| lecun\_normal     | WeightInitLecunNormal       | Yes       |
| glorot\_normal    | GlorotNormal (Xavier)       | Yes       |
| glorot\_uniform   | GlorotUniform (Xavier)      | Yes       |
| he\_normal        | HeNormal                    | Yes       |
| he\_uniform       | HeUniform                   | Yes       |

***

### Regularizers

[Source: KerasRegularizerUtils](https://github.com/eclipse/deeplearning4j/blob/master/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasRegularizerUtils.java)

All standard Keras regularizers are supported:

| Keras Regularizer | DL4J Equivalent    | Supported |
| ----------------- | ------------------ | --------- |
| l1                | L1Regularization   | Yes       |
| l2                | L2Regularization   | Yes       |
| l1\_l2            | L1L2Regularization | Yes       |

***

### Constraints

[Source: KerasConstraintUtils](https://github.com/eclipse/deeplearning4j/blob/master/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasConstraintUtils.java)

All standard Keras constraints are supported:

| Keras Constraint | DL4J Equivalent       | Supported |
| ---------------- | --------------------- | --------- |
| max\_norm        | MaxNormConstraint     | Yes       |
| non\_neg         | NonNegativeConstraint | Yes       |
| unit\_norm       | UnitNormConstraint    | Yes       |
| min\_max\_norm   | MinMaxNormConstraint  | Yes       |

***

### Optimizers

[Source: KerasOptimizerUtils](https://github.com/eclipse/deeplearning4j/blob/master/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasOptimizerUtils.java)

All standard Keras optimizers are supported. TFOptimizer (a TensorFlow-specific optimizer wrapper) is not:

| Keras Optimizer | DL4J Equivalent | Supported |
| --------------- | --------------- | --------- |
| SGD             | Sgd             | Yes       |
| RMSprop         | RmsProp         | Yes       |
| Adagrad         | AdaGrad         | Yes       |
| Adadelta        | AdaDelta        | Yes       |
| Adam            | Adam            | Yes       |
| Adamax          | AdaMax          | Yes       |
| Nadam           | Nadam           | Yes       |
| TFOptimizer     | —               | No        |

***

### Notes on Partial Support

* **GRU**: not currently supported. The Keras GRU has a slightly different recurrent formulation from DL4J's. Consider replacing with LSTM for import, or implement a custom layer mapper.
* **TimeDistributed wrapper**: not supported. In many cases, you can restructure your model to achieve the same effect with 1D convolutions or RNNs directly.
* **ConvLSTM2D**: not supported. No equivalent exists in DL4J core at this time.
* **Dot merge layer**: the dot product merge mode is not supported. Concatenate followed by a Dense layer is a workable alternative in many cases.
* **logcosh loss**: not implemented. `mean_squared_error` is a reasonable substitute for smooth losses.
* **ActivityRegularization**: this layer type is not supported. Apply regularization directly in the layer configuration instead.
* **Custom TensorFlow optimizers (TFOptimizer)**: cannot be imported. Use a standard Keras optimizer.

***

### Keras Version Compatibility

DL4J model import supports both Keras 1.x and Keras 2.x. The importer detects the Keras version from the HDF5 metadata and adjusts config key names accordingly. Both TensorFlow and Theano backends produce compatible HDF5 files.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://deeplearning4j.konduit.ai/en-1.0.0-rewrite/model-import/overview-1/supported-features.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
