Class KerasSequentialModel
- java.lang.Object
-
- org.deeplearning4j.nn.modelimport.keras.KerasModel
-
- org.deeplearning4j.nn.modelimport.keras.KerasSequentialModel
-
public class KerasSequentialModel extends KerasModel
-
-
Field Summary
-
Fields inherited from class org.deeplearning4j.nn.modelimport.keras.KerasModel
className, config, dimOrder, enforceTrainingConfig, inputLayerNames, kerasBackend, kerasMajorVersion, layers, layersOrdered, modelBuilder, optimizer, outputLayerNames, outputTypes, truncatedBPTT, useTruncatedBPTT
-
-
Constructor Summary
Constructors Constructor Description KerasSequentialModel()
Default constructorKerasSequentialModel(String modelJson, String modelYaml, Hdf5Archive weightsArchive, String weightsRoot, String trainingJson, Hdf5Archive trainingArchive, boolean enforceTrainingConfig, int[] inputShape)
(Not recommended) Constructor for Sequential model from model configuration (JSON or YAML), training configuration (JSON), weights, and "training mode" boolean indicator.KerasSequentialModel(KerasModelBuilder modelBuilder)
(Recommended) Builder-pattern constructor for Sequential model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultiLayerConfiguration
getMultiLayerConfiguration()
Configure a MultiLayerConfiguration from this Keras Sequential model configuration.MultiLayerNetwork
getMultiLayerNetwork()
Build a MultiLayerNetwork from this Keras Sequential model configuration.MultiLayerNetwork
getMultiLayerNetwork(boolean importWeights)
Build a MultiLayerNetwork from this Keras Sequential model configuration and import weights.-
Methods inherited from class org.deeplearning4j.nn.modelimport.keras.KerasModel
getComputationGraph, getComputationGraph, getComputationGraphConfiguration, modelBuilder
-
-
-
-
Constructor Detail
-
KerasSequentialModel
public KerasSequentialModel(KerasModelBuilder modelBuilder) throws UnsupportedKerasConfigurationException, IOException, InvalidKerasConfigurationException
(Recommended) Builder-pattern constructor for Sequential model.- Parameters:
modelBuilder
- builder object- Throws:
IOException
- I/O exceptionInvalidKerasConfigurationException
- Invalid Keras configurationUnsupportedKerasConfigurationException
- Unsupported Keras configuration
-
KerasSequentialModel
public KerasSequentialModel(String modelJson, String modelYaml, Hdf5Archive weightsArchive, String weightsRoot, String trainingJson, Hdf5Archive trainingArchive, boolean enforceTrainingConfig, int[] inputShape) throws IOException, InvalidKerasConfigurationException, UnsupportedKerasConfigurationException
(Not recommended) Constructor for Sequential model from model configuration (JSON or YAML), training configuration (JSON), weights, and "training mode" boolean indicator. When built in training mode, certain unsupported configurations (e.g., unknown regularizers) will throw Exceptions. When enforceTrainingConfig=false, these will generate warnings but will be otherwise ignored.- Parameters:
modelJson
- model configuration JSON stringmodelYaml
- model configuration YAML stringtrainingJson
- training configuration JSON string- Throws:
IOException
- I/O exceptionInvalidKerasConfigurationException
UnsupportedKerasConfigurationException
-
KerasSequentialModel
public KerasSequentialModel()
Default constructor
-
-
Method Detail
-
getMultiLayerConfiguration
public MultiLayerConfiguration getMultiLayerConfiguration() throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException
Configure a MultiLayerConfiguration from this Keras Sequential model configuration.- Returns:
- MultiLayerConfiguration
- Throws:
InvalidKerasConfigurationException
UnsupportedKerasConfigurationException
-
getMultiLayerNetwork
public MultiLayerNetwork getMultiLayerNetwork() throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException
Build a MultiLayerNetwork from this Keras Sequential model configuration.- Returns:
- MultiLayerNetwork
- Throws:
InvalidKerasConfigurationException
UnsupportedKerasConfigurationException
-
getMultiLayerNetwork
public MultiLayerNetwork getMultiLayerNetwork(boolean importWeights) throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException
Build a MultiLayerNetwork from this Keras Sequential model configuration and import weights.- Returns:
- MultiLayerNetwork
- Throws:
InvalidKerasConfigurationException
UnsupportedKerasConfigurationException
-
-