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 INDArrayactivate(boolean training, LayerWorkspaceMgr workspaceMgr)Perform forward pass and return the activations array with the last set inputINDArrayactivate(INDArray input, boolean training, LayerWorkspaceMgr workspaceMgr)Perform forward pass and return the activations array with the specified inputvoidcomputeGradientAndScore(LayerWorkspaceMgr workspaceMgr)Update the scoreINDArraydecode(INDArray y, LayerWorkspaceMgr workspaceMgr)INDArrayencode(INDArray v, boolean training, LayerWorkspaceMgr workspaceMgr)booleanisPretrainLayer()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:BasePretrainNetworkSample the hidden distribution given the visible- Specified by:
sampleHiddenGivenVisiblein 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:BasePretrainNetworkSample the visible distribution given the hidden- Specified by:
sampleVisibleGivenHiddenin 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:LayerPerform forward pass and return the activations array with the specified input- Specified by:
activatein interfaceLayer- Overrides:
activatein 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.ACTIVATIONSworkspace via the workspace manager
-
isPretrainLayer
public boolean isPretrainLayer()
Description copied from interface:LayerReturns 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:LayerPerform forward pass and return the activations array with the last set input- Specified by:
activatein interfaceLayer- Overrides:
activatein 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.ACTIVATIONSworkspace via the workspace manager
-
computeGradientAndScore
public void computeGradientAndScore(LayerWorkspaceMgr workspaceMgr)
Description copied from interface:ModelUpdate the score- Specified by:
computeGradientAndScorein interfaceModel- Overrides:
computeGradientAndScorein classBaseLayer<AutoEncoder>
-
-