Keras core layers


KerasPermute

[source]

Imports Permute layer from Keras

KerasPermute
  1. public KerasPermute(Map<String, Object> layerConfig)
  2. throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException

Constructor from parsed Keras layer configuration dictionary.

  • param layerConfig dictionary containing Keras layer configuration
  • throws InvalidKerasConfigurationException Invalid Keras config
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
isInputPreProcessor
  1. public boolean isInputPreProcessor()

Constructor from parsed Keras layer configuration dictionary.

  • param layerConfig dictionary containing Keras layer configuration
  • param enforceTrainingConfig whether to enforce training-related configuration options
  • throws InvalidKerasConfigurationException Invalid Keras config
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
getInputPreprocessor
  1. public InputPreProcessor getInputPreprocessor(InputType... inputType) throws
  2. InvalidKerasConfigurationException

Gets appropriate DL4J InputPreProcessor for given InputTypes.

  • param inputType Array of InputTypes
  • return DL4J InputPreProcessor
  • throws InvalidKerasConfigurationException Invalid Keras config
  • see InputPreProcessor
getOutputType
  1. public InputType getOutputType(InputType... inputType) throws InvalidKerasConfigurationException

Get layer output type.

  • param inputType Array of InputTypes
  • return output type as InputType
  • throws InvalidKerasConfigurationException Invalid Keras config

KerasFlatten

[source]

Imports a Keras Flatten layer as a DL4J {Cnn,Rnn}ToFeedForwardInputPreProcessor.

KerasFlatten
  1. public KerasFlatten(Map<String, Object> layerConfig)
  2. throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException

Constructor from parsed Keras layer configuration dictionary.

  • param layerConfig dictionary containing Keras layer configuration
  • throws InvalidKerasConfigurationException Invalid Keras config
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
isInputPreProcessor
  1. public boolean isInputPreProcessor()

Constructor from parsed Keras layer configuration dictionary.

  • param layerConfig dictionary containing Keras layer configuration
  • param enforceTrainingConfig whether to enforce training-related configuration options
  • throws InvalidKerasConfigurationException Invalid Keras config
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
getInputPreprocessor
  1. public InputPreProcessor getInputPreprocessor(InputType... inputType) throws InvalidKerasConfigurationException

Gets appropriate DL4J InputPreProcessor for given InputTypes.

  • param inputType Array of InputTypes
  • return DL4J InputPreProcessor
  • throws InvalidKerasConfigurationException Invalid Keras config
  • see org.deeplearning4j.nn.conf.InputPreProcessor
getOutputType
  1. public InputType getOutputType(InputType... inputType) throws InvalidKerasConfigurationException

Get layer output type.

  • param inputType Array of InputTypes
  • return output type as InputType
  • throws InvalidKerasConfigurationException Invalid Keras config

KerasReshape

[source]

Imports Reshape layer from Keras

KerasReshape
  1. public KerasReshape(Map<String, Object> layerConfig)
  2. throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException

Constructor from parsed Keras layer configuration dictionary.

  • param layerConfig dictionary containing Keras layer configuration
  • throws InvalidKerasConfigurationException Invalid Keras config
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
isInputPreProcessor
  1. public boolean isInputPreProcessor()

Constructor from parsed Keras layer configuration dictionary.

  • param layerConfig dictionary containing Keras layer configuration
  • param enforceTrainingConfig whether to enforce training-related configuration options
  • throws InvalidKerasConfigurationException Invalid Keras config
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
getInputPreprocessor
  1. public InputPreProcessor getInputPreprocessor(InputType... inputType) throws InvalidKerasConfigurationException

Gets appropriate DL4J InputPreProcessor for given InputTypes.

  • param inputType Array of InputTypes
  • return DL4J InputPreProcessor
  • throws InvalidKerasConfigurationException Invalid Keras config
  • see org.deeplearning4j.nn.conf.InputPreProcessor
getOutputType
  1. public InputType getOutputType(InputType... inputType) throws InvalidKerasConfigurationException

Get layer output type.

  • param inputType Array of InputTypes
  • return output type as InputType
  • throws InvalidKerasConfigurationException Invalid Keras config

KerasMerge

[source]

Imports a Keras Merge layer as a DL4J Merge (graph) vertex.

TODO: handle axes arguments that alter merge behavior (requires changes to DL4J?)

KerasMerge
  1. public KerasMerge(Integer kerasVersion) throws UnsupportedKerasConfigurationException

Pass-through constructor from KerasLayer

  • param kerasVersion major keras version
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
getOutputType
  1. public InputType getOutputType(InputType... inputType)

Constructor from parsed Keras layer configuration dictionary.

  • param layerConfig dictionary containing Keras layer configuration.
  • throws InvalidKerasConfigurationException Invalid Keras config
  • throws UnsupportedKerasConfigurationException Unsupported Keras config

KerasDropout

[source]

Imports a Dropout layer from Keras.

KerasDropout
  1. public KerasDropout(Map<String, Object> layerConfig)
  2. throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException

Constructor from parsed Keras layer configuration dictionary.

  • param layerConfig dictionary containing Keras layer configuration
  • throws InvalidKerasConfigurationException Invalid Keras config
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
getOutputType
  1. public InputType getOutputType(InputType... inputType) throws InvalidKerasConfigurationException

Constructor from parsed Keras layer configuration dictionary.

  • param layerConfig dictionary containing Keras layer configuration
  • param enforceTrainingConfig whether to enforce training-related configuration options
  • throws InvalidKerasConfigurationException Invalid Keras config
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
getDropoutLayer
  1. public DropoutLayer getDropoutLayer()

Get DL4J DropoutLayer.

  • return DropoutLayer

KerasMasking

[source]

Imports Keras masking layers.

KerasMasking
  1. public KerasMasking(Map<String, Object> layerConfig)
  2. throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException

Constructor from parsed Keras layer configuration dictionary.

  • param layerConfig dictionary containing Keras layer configuration
  • throws InvalidKerasConfigurationException Invalid Keras config
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
getOutputType
  1. public InputType getOutputType(InputType... inputType) throws InvalidKerasConfigurationException

Constructor from parsed Keras layer configuration dictionary.

  • param layerConfig dictionary containing Keras layer configuration
  • param enforceTrainingConfig whether to enforce training-related configuration options
  • throws InvalidKerasConfigurationException Invalid Keras config
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
getMaskingLayer
  1. public MaskZeroLayer getMaskingLayer()

Get DL4J MaskZeroLayer.

  • return MaskZeroLayer

KerasSpatialDropout

[source]

Keras wrapper for DL4J dropout layer with SpatialDropout, works 1D-3D.

KerasSpatialDropout
  1. public KerasSpatialDropout(Integer kerasVersion) throws UnsupportedKerasConfigurationException

Pass-through constructor from KerasLayer

  • param kerasVersion major keras version
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
getOutputType
  1. public InputType getOutputType(InputType... inputType) throws InvalidKerasConfigurationException

Constructor from parsed Keras layer configuration dictionary.

  • param layerConfig dictionary containing Keras layer configuration.
  • throws InvalidKerasConfigurationException Invalid Keras config
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
getSpatialDropoutLayer
  1. public DropoutLayer getSpatialDropoutLayer()

Get DL4J DropoutLayer with spatial dropout.

  • return DropoutLayer

KerasLambda

[source]

Wraps a DL4J SameDiffLambda into a KerasLayer

KerasLambda
  1. public KerasLambda(Map<String, Object> layerConfig, SameDiffLayer sameDiffLayer)
  2. throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException

Constructor from parsed Keras layer configuration dictionary.

  • param layerConfig dictionary containing Keras layer configuration
  • throws InvalidKerasConfigurationException Invalid Keras config
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
getOutputType
  1. public InputType getOutputType(InputType... inputType) throws InvalidKerasConfigurationException

Constructor from parsed Keras layer configuration dictionary.

  • param layerConfig dictionary containing Keras layer configuration
  • param enforceTrainingConfig whether to enforce training-related configuration options
  • throws InvalidKerasConfigurationException Invalid Keras config
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
getSameDiffLayer
  1. public SameDiffLayer getSameDiffLayer()

Get DL4J SameDiffLayer.

  • return SameDiffLayer

KerasActivation

[source]

Imports an Activation layer from Keras.

KerasActivation
  1. public KerasActivation(Map<String, Object> layerConfig)
  2. throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException

Constructor from parsed Keras layer configuration dictionary.

  • param layerConfig dictionary containing Keras layer configuration
  • throws InvalidKerasConfigurationException Invalid Keras config
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
getOutputType
  1. public InputType getOutputType(InputType... inputType) throws InvalidKerasConfigurationException

Constructor from parsed Keras layer configuration dictionary.

  • param layerConfig dictionary containing Keras layer configuration
  • param enforceTrainingConfig whether to enforce training-related configuration options
  • throws InvalidKerasConfigurationException Invalid Keras config
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
getActivationLayer
  1. public ActivationLayer getActivationLayer()

Get DL4J ActivationLayer.

  • return ActivationLayer

KerasDense

[source]

Imports a Dense layer from Keras.

KerasDense
  1. public KerasDense(Integer kerasVersion) throws UnsupportedKerasConfigurationException

Pass-through constructor from KerasLayer

  • param kerasVersion major keras version
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
getDenseLayer
  1. public DenseLayer getDenseLayer()

Constructor from parsed Keras layer configuration dictionary.

  • param layerConfig dictionary containing Keras layer configuration
  • throws InvalidKerasConfigurationException Invalid Keras config
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
getOutputType
  1. public InputType getOutputType(InputType... inputType) throws InvalidKerasConfigurationException

Get layer output type.

  • param inputType Array of InputTypes
  • return output type as InputType
  • throws InvalidKerasConfigurationException Invalid Keras config
getNumParams
  1. public int getNumParams()

Returns number of trainable parameters in layer.

  • return number of trainable parameters (2)
setWeights
  1. public void setWeights(Map<String, INDArray> weights) throws InvalidKerasConfigurationException

Set weights for layer.

  • param weights Dense layer weights

KerasRepeatVector

[source]

Imports a Keras RepeatVector layer

KerasRepeatVector
  1. public KerasRepeatVector(Map<String, Object> layerConfig)
  2. throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException

Constructor from parsed Keras layer configuration dictionary.

  • param layerConfig dictionary containing Keras layer configuration
  • throws InvalidKerasConfigurationException Invalid Keras config
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
getOutputType
  1. public InputType getOutputType(InputType... inputType) throws InvalidKerasConfigurationException

Constructor from parsed Keras layer configuration dictionary.

  • param layerConfig dictionary containing Keras layer configuration
  • param enforceTrainingConfig whether to enforce training-related configuration options
  • throws InvalidKerasConfigurationException Invalid Keras config
  • throws UnsupportedKerasConfigurationException Unsupported Keras config
getRepeatVectorLayer
  1. public RepeatVector getRepeatVectorLayer()

Get DL4J RepeatVector.

  • return RepeatVector