Class AutoEncoder
- java.lang.Object
-
- org.deeplearning4j.nn.layers.AbstractLayer<LayerConfT>
-
- org.deeplearning4j.nn.layers.BaseLayer<LayerConfT>
-
- org.deeplearning4j.nn.layers.BasePretrainNetwork<AutoEncoder>
-
- org.deeplearning4j.nn.layers.feedforward.autoencoder.AutoEncoder
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Layer
,Model
,Trainable
public class AutoEncoder extends BasePretrainNetwork<AutoEncoder>
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.deeplearning4j.nn.api.Layer
Layer.TrainingMode, Layer.Type
-
-
Field Summary
-
Fields inherited from class org.deeplearning4j.nn.layers.BaseLayer
gradient, gradientsFlattened, gradientViews, optimizer, params, paramsFlattened, score, solver, weightNoiseParams
-
Fields inherited from class org.deeplearning4j.nn.layers.AbstractLayer
cacheMode, conf, dataType, dropoutApplied, epochCount, index, input, inputModificationAllowed, iterationCount, maskArray, maskState, preOutput, trainingListeners
-
-
Constructor Summary
Constructors Constructor Description AutoEncoder(NeuralNetConfiguration conf, DataType dataType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description INDArray
activate(boolean training, LayerWorkspaceMgr workspaceMgr)
Perform forward pass and return the activations array with the last set inputINDArray
activate(INDArray input, boolean training, LayerWorkspaceMgr workspaceMgr)
Perform forward pass and return the activations array with the specified inputvoid
computeGradientAndScore(LayerWorkspaceMgr workspaceMgr)
Update the scoreINDArray
decode(INDArray y, LayerWorkspaceMgr workspaceMgr)
INDArray
encode(INDArray v, boolean training, LayerWorkspaceMgr workspaceMgr)
boolean
isPretrainLayer()
Returns true if the layer can be trained in an unsupervised/pretrain manner (AE, VAE, etc)Pair<INDArray,INDArray>
sampleHiddenGivenVisible(INDArray v)
Sample the hidden distribution given the visiblePair<INDArray,INDArray>
sampleVisibleGivenHidden(INDArray h)
Sample the visible distribution given the hidden-
Methods inherited from class org.deeplearning4j.nn.layers.BasePretrainNetwork
backpropGradient, calcRegularizationScore, createGradient, getCorruptedInput, numParams, numParams, params, paramTable, setParams, setScoreWithZ
-
Methods inherited from class org.deeplearning4j.nn.layers.BaseLayer
clear, clearNoiseWeightParams, clone, fit, fit, getGradientsViewArray, getOptimizer, getParam, getParamWithNoise, gradient, hasBias, hasLayerNorm, layerConf, paramTable, preOutput, preOutputWithPreNorm, score, setBackpropGradientsViewArray, setParam, setParams, setParamsViewArray, setParamTable, toString, update, update
-
Methods inherited from class org.deeplearning4j.nn.layers.AbstractLayer
addListeners, allowInputModification, applyConstraints, applyDropOutIfNecessary, applyMask, assertInputSet, backpropDropOutIfPresent, batchSize, close, conf, feedForwardMaskArray, getConfig, getEpochCount, getHelper, getIndex, getInput, getInputMiniBatchSize, getListeners, getMaskArray, gradientAndScore, init, input, layerId, setCacheMode, setConf, setEpochCount, setIndex, setInput, setInputMiniBatchSize, setListeners, setListeners, setMaskArray, type, updaterDivideByMinibatch
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.deeplearning4j.nn.api.Layer
getIterationCount, setIterationCount
-
-
-
-
Constructor Detail
-
AutoEncoder
public AutoEncoder(NeuralNetConfiguration conf, DataType dataType)
-
-
Method Detail
-
sampleHiddenGivenVisible
public Pair<INDArray,INDArray> sampleHiddenGivenVisible(INDArray v)
Description copied from class:BasePretrainNetwork
Sample the hidden distribution given the visible- Specified by:
sampleHiddenGivenVisible
in classBasePretrainNetwork<AutoEncoder>
- Parameters:
v
- the visible to sample from- Returns:
- the hidden mean and sample
-
sampleVisibleGivenHidden
public Pair<INDArray,INDArray> sampleVisibleGivenHidden(INDArray h)
Description copied from class:BasePretrainNetwork
Sample the visible distribution given the hidden- Specified by:
sampleVisibleGivenHidden
in classBasePretrainNetwork<AutoEncoder>
- Parameters:
h
- the hidden to sample from- Returns:
- the mean and sample
-
encode
public INDArray encode(INDArray v, boolean training, LayerWorkspaceMgr workspaceMgr)
-
decode
public INDArray decode(INDArray y, LayerWorkspaceMgr workspaceMgr)
-
activate
public INDArray activate(INDArray input, boolean training, LayerWorkspaceMgr workspaceMgr)
Description copied from interface:Layer
Perform forward pass and return the activations array with the specified input- Specified by:
activate
in interfaceLayer
- Overrides:
activate
in classAbstractLayer<AutoEncoder>
- Parameters:
input
- the input to usetraining
- train or test modeworkspaceMgr
- Workspace manager.- Returns:
- Activations array. Note that the returned array should be placed in the
ArrayType.ACTIVATIONS
workspace via the workspace manager
-
isPretrainLayer
public boolean isPretrainLayer()
Description copied from interface:Layer
Returns true if the layer can be trained in an unsupervised/pretrain manner (AE, VAE, etc)- Returns:
- true if the layer can be pretrained (using fit(INDArray), false otherwise
-
activate
public INDArray activate(boolean training, LayerWorkspaceMgr workspaceMgr)
Description copied from interface:Layer
Perform forward pass and return the activations array with the last set input- Specified by:
activate
in interfaceLayer
- Overrides:
activate
in classBaseLayer<AutoEncoder>
- Parameters:
training
- training or test modeworkspaceMgr
- Workspace manager- Returns:
- the activation (layer output) of the last specified input. Note that the returned array should be placed
in the
ArrayType.ACTIVATIONS
workspace via the workspace manager
-
computeGradientAndScore
public void computeGradientAndScore(LayerWorkspaceMgr workspaceMgr)
Description copied from interface:Model
Update the score- Specified by:
computeGradientAndScore
in interfaceModel
- Overrides:
computeGradientAndScore
in classBaseLayer<AutoEncoder>
-
-