Keras Import
Importing Keras models into Deeplearning4j — supported features, limitations, and getting started
Keras Model Import
Quick Start
from keras.models import Sequential
from keras.layers import Dense
model = Sequential()
model.add(Dense(units=64, activation='relu', input_dim=100))
model.add(Dense(units=10, activation='softmax'))
model.compile(loss='categorical_crossentropy', optimizer='sgd', metrics=['accuracy'])
model.save('simple_mlp.h5')String simpleMlp = new ClassPathResource("simple_mlp.h5").getFile().getPath();
MultiLayerNetwork model = KerasModelImport.importKerasSequentialModelAndWeights(simpleMlp);
INDArray input = Nd4j.create(256, 100);
INDArray output = model.output(input);Maven Dependency
Model Types
Keras model type
Keras class
DL4J equivalent
Saving Formats
What is saved
Python call
DL4J import method
Popular Supported Models
Supported Features Summary
Category
Coverage
After Import: Saving the DL4J Model
Troubleshooting
Why Keras Model Import?
Next Steps
Last updated
Was this helpful?